{
  "cells": [
    {
      "cell_type": "markdown",
      "id": "8d0e81ed",
      "metadata": {},
      "source": [
        "<div align=\"center\">\n",
        "<h2>ReRanker RAG</h2>\n",
        "</div>\n",
        "\n",
        "<div align=\"center\">\n",
        "    <h3 ><a href=\"https://aiengineering.academy/\" target=\"_blank\">AI Engineering.academy</a></h3>\n",
        "    \n",
        "    \n",
        "</div>\n",
        "\n",
        "<div align=\"center\">\n",
        "<a href=\"https://aiengineering.academy/\" target=\"_blank\">\n",
        "<img src=\"https://raw.githubusercontent.com/adithya-s-k/AI-Engineering.academy/main/assets/banner.png\" alt=\"Ai Engineering. Academy\" width=\"50%\">\n",
        "</a>\n",
        "</div>\n",
        "\n",
        "\n",
        "<div align=\"center\">\n",
        "\n",
        "[![GitHub Stars](https://img.shields.io/github/stars/adithya-s-k/AI-Engineering.academy?style=social)](https://github.com/adithya-s-k/AI-Engineering.academy/stargazers)\n",
        "[![GitHub Forks](https://img.shields.io/github/forks/adithya-s-k/AI-Engineering.academy?style=social)](https://github.com/adithya-s-k/AI-Engineering.academy/network/members)\n",
        "[![GitHub Issues](https://img.shields.io/github/issues/adithya-s-k/AI-Engineering.academy)](https://github.com/adithya-s-k/AI-Engineering.academy/issues)\n",
        "[![GitHub Pull Requests](https://img.shields.io/github/issues-pr/adithya-s-k/AI-Engineering.academy)](https://github.com/adithya-s-k/AI-Engineering.academy/pulls)\n",
        "[![License](https://img.shields.io/github/license/adithya-s-k/AI-Engineering.academy)](https://github.com/adithya-s-k/AI-Engineering.academy/blob/main/LICENSE)\n",
        "\n",
        "</div>"
      ]
    },
    {
      "cell_type": "markdown",
      "id": "ce3c83b8",
      "metadata": {},
      "source": [
        "## Setting up the Environment"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 3,
      "id": "8a4a5db8",
      "metadata": {},
      "outputs": [
        {
          "name": "stdout",
          "output_type": "stream",
          "text": [
            "Requirement already satisfied: nest-asyncio in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (1.6.0)\n",
            "Requirement already satisfied: llama-index in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (0.10.51)\n",
            "Collecting llama-index\n",
            "  Using cached llama_index-0.11.10-py3-none-any.whl.metadata (11 kB)\n",
            "Collecting llama-index-agent-openai<0.4.0,>=0.3.1 (from llama-index)\n",
            "  Using cached llama_index_agent_openai-0.3.4-py3-none-any.whl.metadata (728 bytes)\n",
            "Collecting llama-index-cli<0.4.0,>=0.3.1 (from llama-index)\n",
            "  Using cached llama_index_cli-0.3.1-py3-none-any.whl.metadata (1.5 kB)\n",
            "Requirement already satisfied: llama-index-core<0.12.0,>=0.11.10 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from llama-index) (0.11.10)\n",
            "Collecting llama-index-embeddings-openai<0.3.0,>=0.2.4 (from llama-index)\n",
            "  Using cached llama_index_embeddings_openai-0.2.5-py3-none-any.whl.metadata (686 bytes)\n",
            "Collecting llama-index-indices-managed-llama-cloud>=0.3.0 (from llama-index)\n",
            "  Using cached llama_index_indices_managed_llama_cloud-0.3.1-py3-none-any.whl.metadata (3.8 kB)\n",
            "Requirement already satisfied: llama-index-legacy<0.10.0,>=0.9.48 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from llama-index) (0.9.48.post3)\n",
            "Collecting llama-index-llms-openai<0.3.0,>=0.2.3 (from llama-index)\n",
            "  Using cached llama_index_llms_openai-0.2.9-py3-none-any.whl.metadata (648 bytes)\n",
            "Collecting llama-index-multi-modal-llms-openai<0.3.0,>=0.2.0 (from llama-index)\n",
            "  Using cached llama_index_multi_modal_llms_openai-0.2.1-py3-none-any.whl.metadata (728 bytes)\n",
            "Collecting llama-index-program-openai<0.3.0,>=0.2.0 (from llama-index)\n",
            "  Using cached llama_index_program_openai-0.2.0-py3-none-any.whl.metadata (766 bytes)\n",
            "Collecting llama-index-question-gen-openai<0.3.0,>=0.2.0 (from llama-index)\n",
            "  Using cached llama_index_question_gen_openai-0.2.0-py3-none-any.whl.metadata (785 bytes)\n",
            "Collecting llama-index-readers-file<0.3.0,>=0.2.0 (from llama-index)\n",
            "  Using cached llama_index_readers_file-0.2.2-py3-none-any.whl.metadata (5.4 kB)\n",
            "Collecting llama-index-readers-llama-parse>=0.3.0 (from llama-index)\n",
            "  Using cached llama_index_readers_llama_parse-0.3.0-py3-none-any.whl.metadata (3.5 kB)\n",
            "Requirement already satisfied: nltk>3.8.1 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from llama-index) (3.9.1)\n",
            "Requirement already satisfied: openai>=1.14.0 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from llama-index-agent-openai<0.4.0,>=0.3.1->llama-index) (1.44.0)\n",
            "Requirement already satisfied: PyYAML>=6.0.1 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from llama-index-core<0.12.0,>=0.11.10->llama-index) (6.0.2)\n",
            "Requirement already satisfied: SQLAlchemy>=1.4.49 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from SQLAlchemy[asyncio]>=1.4.49->llama-index-core<0.12.0,>=0.11.10->llama-index) (2.0.34)\n",
            "Requirement already satisfied: aiohttp<4.0.0,>=3.8.6 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from llama-index-core<0.12.0,>=0.11.10->llama-index) (3.10.5)\n",
            "Requirement already satisfied: dataclasses-json in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from llama-index-core<0.12.0,>=0.11.10->llama-index) (0.5.14)\n",
            "Requirement already satisfied: deprecated>=1.2.9.3 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from llama-index-core<0.12.0,>=0.11.10->llama-index) (1.2.14)\n",
            "Requirement already satisfied: dirtyjson<2.0.0,>=1.0.8 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from llama-index-core<0.12.0,>=0.11.10->llama-index) (1.0.8)\n",
            "Requirement already satisfied: fsspec>=2023.5.0 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from llama-index-core<0.12.0,>=0.11.10->llama-index) (2024.6.1)\n",
            "Requirement already satisfied: httpx in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from llama-index-core<0.12.0,>=0.11.10->llama-index) (0.27.2)\n",
            "Requirement already satisfied: nest-asyncio<2.0.0,>=1.5.8 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from llama-index-core<0.12.0,>=0.11.10->llama-index) (1.6.0)\n",
            "Requirement already satisfied: networkx>=3.0 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from llama-index-core<0.12.0,>=0.11.10->llama-index) (3.3)\n",
            "Requirement already satisfied: numpy<2.0.0 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from llama-index-core<0.12.0,>=0.11.10->llama-index) (1.26.4)\n",
            "Requirement already satisfied: pillow>=9.0.0 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from llama-index-core<0.12.0,>=0.11.10->llama-index) (10.4.0)\n",
            "Requirement already satisfied: pydantic<3.0.0,>=2.7.0 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from llama-index-core<0.12.0,>=0.11.10->llama-index) (2.9.1)\n",
            "Requirement already satisfied: requests>=2.31.0 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from llama-index-core<0.12.0,>=0.11.10->llama-index) (2.32.3)\n",
            "Requirement already satisfied: tenacity!=8.4.0,<9.0.0,>=8.2.0 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from llama-index-core<0.12.0,>=0.11.10->llama-index) (8.4.2)\n",
            "Requirement already satisfied: tiktoken>=0.3.3 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from llama-index-core<0.12.0,>=0.11.10->llama-index) (0.7.0)\n",
            "Requirement already satisfied: tqdm<5.0.0,>=4.66.1 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from llama-index-core<0.12.0,>=0.11.10->llama-index) (4.66.5)\n",
            "Requirement already satisfied: typing-extensions>=4.5.0 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from llama-index-core<0.12.0,>=0.11.10->llama-index) (4.12.2)\n",
            "Requirement already satisfied: typing-inspect>=0.8.0 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from llama-index-core<0.12.0,>=0.11.10->llama-index) (0.9.0)\n",
            "Requirement already satisfied: wrapt in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from llama-index-core<0.12.0,>=0.11.10->llama-index) (1.16.0)\n",
            "Collecting llama-cloud>=0.0.11 (from llama-index-indices-managed-llama-cloud>=0.3.0->llama-index)\n",
            "  Using cached llama_cloud-0.0.17-py3-none-any.whl.metadata (751 bytes)\n",
            "Requirement already satisfied: pandas in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from llama-index-legacy<0.10.0,>=0.9.48->llama-index) (2.2.2)\n",
            "Requirement already satisfied: beautifulsoup4<5.0.0,>=4.12.3 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from llama-index-readers-file<0.3.0,>=0.2.0->llama-index) (4.12.3)\n",
            "Requirement already satisfied: pypdf<5.0.0,>=4.0.1 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from llama-index-readers-file<0.3.0,>=0.2.0->llama-index) (4.3.1)\n",
            "Requirement already satisfied: striprtf<0.0.27,>=0.0.26 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from llama-index-readers-file<0.3.0,>=0.2.0->llama-index) (0.0.26)\n",
            "Collecting llama-parse>=0.5.0 (from llama-index-readers-llama-parse>=0.3.0->llama-index)\n",
            "  Using cached llama_parse-0.5.6-py3-none-any.whl.metadata (6.1 kB)\n",
            "Requirement already satisfied: click in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from nltk>3.8.1->llama-index) (8.1.7)\n",
            "Requirement already satisfied: joblib in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from nltk>3.8.1->llama-index) (1.4.2)\n",
            "Requirement already satisfied: regex>=2021.8.3 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from nltk>3.8.1->llama-index) (2024.7.24)\n",
            "Requirement already satisfied: aiohappyeyeballs>=2.3.0 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from aiohttp<4.0.0,>=3.8.6->llama-index-core<0.12.0,>=0.11.10->llama-index) (2.4.0)\n",
            "Requirement already satisfied: aiosignal>=1.1.2 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from aiohttp<4.0.0,>=3.8.6->llama-index-core<0.12.0,>=0.11.10->llama-index) (1.3.1)\n",
            "Requirement already satisfied: attrs>=17.3.0 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from aiohttp<4.0.0,>=3.8.6->llama-index-core<0.12.0,>=0.11.10->llama-index) (24.2.0)\n",
            "Requirement already satisfied: frozenlist>=1.1.1 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from aiohttp<4.0.0,>=3.8.6->llama-index-core<0.12.0,>=0.11.10->llama-index) (1.4.1)\n",
            "Requirement already satisfied: multidict<7.0,>=4.5 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from aiohttp<4.0.0,>=3.8.6->llama-index-core<0.12.0,>=0.11.10->llama-index) (6.0.5)\n",
            "Requirement already satisfied: yarl<2.0,>=1.0 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from aiohttp<4.0.0,>=3.8.6->llama-index-core<0.12.0,>=0.11.10->llama-index) (1.11.0)\n",
            "Requirement already satisfied: async-timeout<5.0,>=4.0 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from aiohttp<4.0.0,>=3.8.6->llama-index-core<0.12.0,>=0.11.10->llama-index) (4.0.3)\n",
            "Requirement already satisfied: soupsieve>1.2 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from beautifulsoup4<5.0.0,>=4.12.3->llama-index-readers-file<0.3.0,>=0.2.0->llama-index) (2.6)\n",
            "Requirement already satisfied: anyio in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from httpx->llama-index-core<0.12.0,>=0.11.10->llama-index) (4.4.0)\n",
            "Requirement already satisfied: certifi in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from httpx->llama-index-core<0.12.0,>=0.11.10->llama-index) (2024.8.30)\n",
            "Requirement already satisfied: httpcore==1.* in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from httpx->llama-index-core<0.12.0,>=0.11.10->llama-index) (1.0.5)\n",
            "Requirement already satisfied: idna in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from httpx->llama-index-core<0.12.0,>=0.11.10->llama-index) (3.8)\n",
            "Requirement already satisfied: sniffio in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from httpx->llama-index-core<0.12.0,>=0.11.10->llama-index) (1.3.1)\n",
            "Requirement already satisfied: h11<0.15,>=0.13 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from httpcore==1.*->httpx->llama-index-core<0.12.0,>=0.11.10->llama-index) (0.14.0)\n",
            "Requirement already satisfied: distro<2,>=1.7.0 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from openai>=1.14.0->llama-index-agent-openai<0.4.0,>=0.3.1->llama-index) (1.9.0)\n",
            "Requirement already satisfied: jiter<1,>=0.4.0 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from openai>=1.14.0->llama-index-agent-openai<0.4.0,>=0.3.1->llama-index) (0.5.0)\n",
            "Requirement already satisfied: annotated-types>=0.6.0 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from pydantic<3.0.0,>=2.7.0->llama-index-core<0.12.0,>=0.11.10->llama-index) (0.7.0)\n",
            "Requirement already satisfied: pydantic-core==2.23.3 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from pydantic<3.0.0,>=2.7.0->llama-index-core<0.12.0,>=0.11.10->llama-index) (2.23.3)\n",
            "Requirement already satisfied: charset-normalizer<4,>=2 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from requests>=2.31.0->llama-index-core<0.12.0,>=0.11.10->llama-index) (3.3.2)\n",
            "Requirement already satisfied: urllib3<3,>=1.21.1 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from requests>=2.31.0->llama-index-core<0.12.0,>=0.11.10->llama-index) (2.2.2)\n",
            "Requirement already satisfied: greenlet!=0.4.17 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from SQLAlchemy>=1.4.49->SQLAlchemy[asyncio]>=1.4.49->llama-index-core<0.12.0,>=0.11.10->llama-index) (3.0.3)\n",
            "Requirement already satisfied: mypy-extensions>=0.3.0 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from typing-inspect>=0.8.0->llama-index-core<0.12.0,>=0.11.10->llama-index) (1.0.0)\n",
            "Requirement already satisfied: marshmallow<4.0.0,>=3.18.0 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from dataclasses-json->llama-index-core<0.12.0,>=0.11.10->llama-index) (3.22.0)\n",
            "Requirement already satisfied: python-dateutil>=2.8.2 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from pandas->llama-index-legacy<0.10.0,>=0.9.48->llama-index) (2.9.0)\n",
            "Requirement already satisfied: pytz>=2020.1 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from pandas->llama-index-legacy<0.10.0,>=0.9.48->llama-index) (2024.1)\n",
            "Requirement already satisfied: tzdata>=2022.7 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from pandas->llama-index-legacy<0.10.0,>=0.9.48->llama-index) (2024.1)\n",
            "Requirement already satisfied: exceptiongroup>=1.0.2 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from anyio->httpx->llama-index-core<0.12.0,>=0.11.10->llama-index) (1.2.2)\n",
            "Requirement already satisfied: packaging>=17.0 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from marshmallow<4.0.0,>=3.18.0->dataclasses-json->llama-index-core<0.12.0,>=0.11.10->llama-index) (23.2)\n",
            "Requirement already satisfied: six>=1.5 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from python-dateutil>=2.8.2->pandas->llama-index-legacy<0.10.0,>=0.9.48->llama-index) (1.16.0)\n",
            "Using cached llama_index-0.11.10-py3-none-any.whl (6.8 kB)\n",
            "Using cached llama_index_agent_openai-0.3.4-py3-none-any.whl (13 kB)\n",
            "Using cached llama_index_cli-0.3.1-py3-none-any.whl (27 kB)\n",
            "Using cached llama_index_embeddings_openai-0.2.5-py3-none-any.whl (6.1 kB)\n",
            "Using cached llama_index_indices_managed_llama_cloud-0.3.1-py3-none-any.whl (10 kB)\n",
            "Using cached llama_index_llms_openai-0.2.9-py3-none-any.whl (12 kB)\n",
            "Using cached llama_index_multi_modal_llms_openai-0.2.1-py3-none-any.whl (5.9 kB)\n",
            "Using cached llama_index_program_openai-0.2.0-py3-none-any.whl (5.3 kB)\n",
            "Using cached llama_index_question_gen_openai-0.2.0-py3-none-any.whl (2.9 kB)\n",
            "Using cached llama_index_readers_file-0.2.2-py3-none-any.whl (38 kB)\n",
            "Using cached llama_index_readers_llama_parse-0.3.0-py3-none-any.whl (2.5 kB)\n",
            "Using cached llama_cloud-0.0.17-py3-none-any.whl (187 kB)\n",
            "Using cached llama_parse-0.5.6-py3-none-any.whl (10 kB)\n",
            "Installing collected packages: llama-cloud, llama-parse, llama-index-readers-file, llama-index-llms-openai, llama-index-indices-managed-llama-cloud, llama-index-embeddings-openai, llama-index-readers-llama-parse, llama-index-multi-modal-llms-openai, llama-index-cli, llama-index-agent-openai, llama-index-program-openai, llama-index-question-gen-openai, llama-index\n",
            "  Attempting uninstall: llama-cloud\n",
            "    Found existing installation: llama-cloud 0.0.6\n",
            "    Uninstalling llama-cloud-0.0.6:\n",
            "      Successfully uninstalled llama-cloud-0.0.6\n",
            "  Attempting uninstall: llama-parse\n",
            "    Found existing installation: llama-parse 0.4.9\n",
            "    Uninstalling llama-parse-0.4.9:\n",
            "      Successfully uninstalled llama-parse-0.4.9\n",
            "  Attempting uninstall: llama-index-readers-file\n",
            "    Found existing installation: llama-index-readers-file 0.1.25\n",
            "    Uninstalling llama-index-readers-file-0.1.25:\n",
            "      Successfully uninstalled llama-index-readers-file-0.1.25\n",
            "  Attempting uninstall: llama-index-llms-openai\n",
            "    Found existing installation: llama-index-llms-openai 0.1.24\n",
            "    Uninstalling llama-index-llms-openai-0.1.24:\n",
            "      Successfully uninstalled llama-index-llms-openai-0.1.24\n",
            "  Attempting uninstall: llama-index-indices-managed-llama-cloud\n",
            "    Found existing installation: llama-index-indices-managed-llama-cloud 0.2.4\n",
            "    Uninstalling llama-index-indices-managed-llama-cloud-0.2.4:\n",
            "      Successfully uninstalled llama-index-indices-managed-llama-cloud-0.2.4\n",
            "  Attempting uninstall: llama-index-embeddings-openai\n",
            "    Found existing installation: llama-index-embeddings-openai 0.1.10\n",
            "    Uninstalling llama-index-embeddings-openai-0.1.10:\n",
            "      Successfully uninstalled llama-index-embeddings-openai-0.1.10\n",
            "  Attempting uninstall: llama-index-readers-llama-parse\n",
            "    Found existing installation: llama-index-readers-llama-parse 0.1.6\n",
            "    Uninstalling llama-index-readers-llama-parse-0.1.6:\n",
            "      Successfully uninstalled llama-index-readers-llama-parse-0.1.6\n",
            "  Attempting uninstall: llama-index-multi-modal-llms-openai\n",
            "    Found existing installation: llama-index-multi-modal-llms-openai 0.1.9\n",
            "    Uninstalling llama-index-multi-modal-llms-openai-0.1.9:\n",
            "      Successfully uninstalled llama-index-multi-modal-llms-openai-0.1.9\n",
            "  Attempting uninstall: llama-index-cli\n",
            "    Found existing installation: llama-index-cli 0.1.13\n",
            "    Uninstalling llama-index-cli-0.1.13:\n",
            "      Successfully uninstalled llama-index-cli-0.1.13\n",
            "  Attempting uninstall: llama-index-agent-openai\n",
            "    Found existing installation: llama-index-agent-openai 0.2.7\n",
            "    Uninstalling llama-index-agent-openai-0.2.7:\n",
            "      Successfully uninstalled llama-index-agent-openai-0.2.7\n",
            "  Attempting uninstall: llama-index-program-openai\n",
            "    Found existing installation: llama-index-program-openai 0.1.6\n",
            "    Uninstalling llama-index-program-openai-0.1.6:\n",
            "      Successfully uninstalled llama-index-program-openai-0.1.6\n",
            "  Attempting uninstall: llama-index-question-gen-openai\n",
            "    Found existing installation: llama-index-question-gen-openai 0.1.3\n",
            "    Uninstalling llama-index-question-gen-openai-0.1.3:\n",
            "      Successfully uninstalled llama-index-question-gen-openai-0.1.3\n",
            "  Attempting uninstall: llama-index\n",
            "    Found existing installation: llama-index 0.10.51\n",
            "    Uninstalling llama-index-0.10.51:\n",
            "      Successfully uninstalled llama-index-0.10.51\n",
            "Successfully installed llama-cloud-0.0.17 llama-index-0.11.10 llama-index-agent-openai-0.3.4 llama-index-cli-0.3.1 llama-index-embeddings-openai-0.2.5 llama-index-indices-managed-llama-cloud-0.3.1 llama-index-llms-openai-0.2.9 llama-index-multi-modal-llms-openai-0.2.1 llama-index-program-openai-0.2.0 llama-index-question-gen-openai-0.2.0 llama-index-readers-file-0.2.2 llama-index-readers-llama-parse-0.3.0 llama-parse-0.5.6\n",
            "Requirement already satisfied: llama-index-vector-stores-qdrant in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (0.3.0)\n",
            "Requirement already satisfied: grpcio<2.0.0,>=1.60.0 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from llama-index-vector-stores-qdrant) (1.63.2)\n",
            "Requirement already satisfied: llama-index-core<0.12.0,>=0.11.0 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from llama-index-vector-stores-qdrant) (0.11.10)\n",
            "Requirement already satisfied: qdrant-client>=1.7.1 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from llama-index-vector-stores-qdrant) (1.11.2)\n",
            "Requirement already satisfied: PyYAML>=6.0.1 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from llama-index-core<0.12.0,>=0.11.0->llama-index-vector-stores-qdrant) (6.0.2)\n",
            "Requirement already satisfied: SQLAlchemy>=1.4.49 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from SQLAlchemy[asyncio]>=1.4.49->llama-index-core<0.12.0,>=0.11.0->llama-index-vector-stores-qdrant) (2.0.34)\n",
            "Requirement already satisfied: aiohttp<4.0.0,>=3.8.6 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from llama-index-core<0.12.0,>=0.11.0->llama-index-vector-stores-qdrant) (3.10.5)\n",
            "Requirement already satisfied: dataclasses-json in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from llama-index-core<0.12.0,>=0.11.0->llama-index-vector-stores-qdrant) (0.5.14)\n",
            "Requirement already satisfied: deprecated>=1.2.9.3 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from llama-index-core<0.12.0,>=0.11.0->llama-index-vector-stores-qdrant) (1.2.14)\n",
            "Requirement already satisfied: dirtyjson<2.0.0,>=1.0.8 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from llama-index-core<0.12.0,>=0.11.0->llama-index-vector-stores-qdrant) (1.0.8)\n",
            "Requirement already satisfied: fsspec>=2023.5.0 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from llama-index-core<0.12.0,>=0.11.0->llama-index-vector-stores-qdrant) (2024.6.1)\n",
            "Requirement already satisfied: httpx in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from llama-index-core<0.12.0,>=0.11.0->llama-index-vector-stores-qdrant) (0.27.2)\n",
            "Requirement already satisfied: nest-asyncio<2.0.0,>=1.5.8 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from llama-index-core<0.12.0,>=0.11.0->llama-index-vector-stores-qdrant) (1.6.0)\n",
            "Requirement already satisfied: networkx>=3.0 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from llama-index-core<0.12.0,>=0.11.0->llama-index-vector-stores-qdrant) (3.3)\n",
            "Requirement already satisfied: nltk>3.8.1 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from llama-index-core<0.12.0,>=0.11.0->llama-index-vector-stores-qdrant) (3.9.1)\n",
            "Requirement already satisfied: numpy<2.0.0 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from llama-index-core<0.12.0,>=0.11.0->llama-index-vector-stores-qdrant) (1.26.4)\n",
            "Requirement already satisfied: pillow>=9.0.0 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from llama-index-core<0.12.0,>=0.11.0->llama-index-vector-stores-qdrant) (10.4.0)\n",
            "Requirement already satisfied: pydantic<3.0.0,>=2.7.0 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from llama-index-core<0.12.0,>=0.11.0->llama-index-vector-stores-qdrant) (2.9.1)\n",
            "Requirement already satisfied: requests>=2.31.0 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from llama-index-core<0.12.0,>=0.11.0->llama-index-vector-stores-qdrant) (2.32.3)\n",
            "Requirement already satisfied: tenacity!=8.4.0,<9.0.0,>=8.2.0 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from llama-index-core<0.12.0,>=0.11.0->llama-index-vector-stores-qdrant) (8.4.2)\n",
            "Requirement already satisfied: tiktoken>=0.3.3 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from llama-index-core<0.12.0,>=0.11.0->llama-index-vector-stores-qdrant) (0.7.0)\n",
            "Requirement already satisfied: tqdm<5.0.0,>=4.66.1 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from llama-index-core<0.12.0,>=0.11.0->llama-index-vector-stores-qdrant) (4.66.5)\n",
            "Requirement already satisfied: typing-extensions>=4.5.0 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from llama-index-core<0.12.0,>=0.11.0->llama-index-vector-stores-qdrant) (4.12.2)\n",
            "Requirement already satisfied: typing-inspect>=0.8.0 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from llama-index-core<0.12.0,>=0.11.0->llama-index-vector-stores-qdrant) (0.9.0)\n",
            "Requirement already satisfied: wrapt in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from llama-index-core<0.12.0,>=0.11.0->llama-index-vector-stores-qdrant) (1.16.0)\n",
            "Requirement already satisfied: grpcio-tools>=1.41.0 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from qdrant-client>=1.7.1->llama-index-vector-stores-qdrant) (1.62.3)\n",
            "Requirement already satisfied: portalocker<3.0.0,>=2.7.0 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from qdrant-client>=1.7.1->llama-index-vector-stores-qdrant) (2.10.1)\n",
            "Requirement already satisfied: urllib3<3,>=1.26.14 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from qdrant-client>=1.7.1->llama-index-vector-stores-qdrant) (2.2.2)\n",
            "Requirement already satisfied: aiohappyeyeballs>=2.3.0 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from aiohttp<4.0.0,>=3.8.6->llama-index-core<0.12.0,>=0.11.0->llama-index-vector-stores-qdrant) (2.4.0)\n",
            "Requirement already satisfied: aiosignal>=1.1.2 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from aiohttp<4.0.0,>=3.8.6->llama-index-core<0.12.0,>=0.11.0->llama-index-vector-stores-qdrant) (1.3.1)\n",
            "Requirement already satisfied: attrs>=17.3.0 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from aiohttp<4.0.0,>=3.8.6->llama-index-core<0.12.0,>=0.11.0->llama-index-vector-stores-qdrant) (24.2.0)\n",
            "Requirement already satisfied: frozenlist>=1.1.1 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from aiohttp<4.0.0,>=3.8.6->llama-index-core<0.12.0,>=0.11.0->llama-index-vector-stores-qdrant) (1.4.1)\n",
            "Requirement already satisfied: multidict<7.0,>=4.5 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from aiohttp<4.0.0,>=3.8.6->llama-index-core<0.12.0,>=0.11.0->llama-index-vector-stores-qdrant) (6.0.5)\n",
            "Requirement already satisfied: yarl<2.0,>=1.0 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from aiohttp<4.0.0,>=3.8.6->llama-index-core<0.12.0,>=0.11.0->llama-index-vector-stores-qdrant) (1.11.0)\n",
            "Requirement already satisfied: async-timeout<5.0,>=4.0 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from aiohttp<4.0.0,>=3.8.6->llama-index-core<0.12.0,>=0.11.0->llama-index-vector-stores-qdrant) (4.0.3)\n",
            "Requirement already satisfied: protobuf<5.0dev,>=4.21.6 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from grpcio-tools>=1.41.0->qdrant-client>=1.7.1->llama-index-vector-stores-qdrant) (4.25.4)\n",
            "Requirement already satisfied: setuptools in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from grpcio-tools>=1.41.0->qdrant-client>=1.7.1->llama-index-vector-stores-qdrant) (72.1.0)\n",
            "Requirement already satisfied: anyio in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from httpx->llama-index-core<0.12.0,>=0.11.0->llama-index-vector-stores-qdrant) (4.4.0)\n",
            "Requirement already satisfied: certifi in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from httpx->llama-index-core<0.12.0,>=0.11.0->llama-index-vector-stores-qdrant) (2024.8.30)\n",
            "Requirement already satisfied: httpcore==1.* in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from httpx->llama-index-core<0.12.0,>=0.11.0->llama-index-vector-stores-qdrant) (1.0.5)\n",
            "Requirement already satisfied: idna in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from httpx->llama-index-core<0.12.0,>=0.11.0->llama-index-vector-stores-qdrant) (3.8)\n",
            "Requirement already satisfied: sniffio in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from httpx->llama-index-core<0.12.0,>=0.11.0->llama-index-vector-stores-qdrant) (1.3.1)\n",
            "Requirement already satisfied: h11<0.15,>=0.13 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from httpcore==1.*->httpx->llama-index-core<0.12.0,>=0.11.0->llama-index-vector-stores-qdrant) (0.14.0)\n",
            "Requirement already satisfied: h2<5,>=3 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from httpx[http2]>=0.20.0->qdrant-client>=1.7.1->llama-index-vector-stores-qdrant) (4.1.0)\n",
            "Requirement already satisfied: click in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from nltk>3.8.1->llama-index-core<0.12.0,>=0.11.0->llama-index-vector-stores-qdrant) (8.1.7)\n",
            "Requirement already satisfied: joblib in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from nltk>3.8.1->llama-index-core<0.12.0,>=0.11.0->llama-index-vector-stores-qdrant) (1.4.2)\n",
            "Requirement already satisfied: regex>=2021.8.3 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from nltk>3.8.1->llama-index-core<0.12.0,>=0.11.0->llama-index-vector-stores-qdrant) (2024.7.24)\n",
            "Requirement already satisfied: annotated-types>=0.6.0 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from pydantic<3.0.0,>=2.7.0->llama-index-core<0.12.0,>=0.11.0->llama-index-vector-stores-qdrant) (0.7.0)\n",
            "Requirement already satisfied: pydantic-core==2.23.3 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from pydantic<3.0.0,>=2.7.0->llama-index-core<0.12.0,>=0.11.0->llama-index-vector-stores-qdrant) (2.23.3)\n",
            "Requirement already satisfied: charset-normalizer<4,>=2 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from requests>=2.31.0->llama-index-core<0.12.0,>=0.11.0->llama-index-vector-stores-qdrant) (3.3.2)\n",
            "Requirement already satisfied: greenlet!=0.4.17 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from SQLAlchemy>=1.4.49->SQLAlchemy[asyncio]>=1.4.49->llama-index-core<0.12.0,>=0.11.0->llama-index-vector-stores-qdrant) (3.0.3)\n",
            "Requirement already satisfied: mypy-extensions>=0.3.0 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from typing-inspect>=0.8.0->llama-index-core<0.12.0,>=0.11.0->llama-index-vector-stores-qdrant) (1.0.0)\n",
            "Requirement already satisfied: marshmallow<4.0.0,>=3.18.0 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from dataclasses-json->llama-index-core<0.12.0,>=0.11.0->llama-index-vector-stores-qdrant) (3.22.0)\n",
            "Requirement already satisfied: hyperframe<7,>=6.0 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from h2<5,>=3->httpx[http2]>=0.20.0->qdrant-client>=1.7.1->llama-index-vector-stores-qdrant) (6.0.1)\n",
            "Requirement already satisfied: hpack<5,>=4.0 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from h2<5,>=3->httpx[http2]>=0.20.0->qdrant-client>=1.7.1->llama-index-vector-stores-qdrant) (4.0.0)\n",
            "Requirement already satisfied: packaging>=17.0 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from marshmallow<4.0.0,>=3.18.0->dataclasses-json->llama-index-core<0.12.0,>=0.11.0->llama-index-vector-stores-qdrant) (23.2)\n",
            "Requirement already satisfied: exceptiongroup>=1.0.2 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from anyio->httpx->llama-index-core<0.12.0,>=0.11.0->llama-index-vector-stores-qdrant) (1.2.2)\n",
            "Requirement already satisfied: llama-index-readers-file in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (0.2.2)\n",
            "Requirement already satisfied: beautifulsoup4<5.0.0,>=4.12.3 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from llama-index-readers-file) (4.12.3)\n",
            "Requirement already satisfied: llama-index-core<0.12.0,>=0.11.0 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from llama-index-readers-file) (0.11.10)\n",
            "Requirement already satisfied: pandas in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from llama-index-readers-file) (2.2.2)\n",
            "Requirement already satisfied: pypdf<5.0.0,>=4.0.1 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from llama-index-readers-file) (4.3.1)\n",
            "Requirement already satisfied: striprtf<0.0.27,>=0.0.26 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from llama-index-readers-file) (0.0.26)\n",
            "Requirement already satisfied: soupsieve>1.2 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from beautifulsoup4<5.0.0,>=4.12.3->llama-index-readers-file) (2.6)\n",
            "Requirement already satisfied: PyYAML>=6.0.1 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from llama-index-core<0.12.0,>=0.11.0->llama-index-readers-file) (6.0.2)\n",
            "Requirement already satisfied: SQLAlchemy>=1.4.49 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from SQLAlchemy[asyncio]>=1.4.49->llama-index-core<0.12.0,>=0.11.0->llama-index-readers-file) (2.0.34)\n",
            "Requirement already satisfied: aiohttp<4.0.0,>=3.8.6 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from llama-index-core<0.12.0,>=0.11.0->llama-index-readers-file) (3.10.5)\n",
            "Requirement already satisfied: dataclasses-json in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from llama-index-core<0.12.0,>=0.11.0->llama-index-readers-file) (0.5.14)\n",
            "Requirement already satisfied: deprecated>=1.2.9.3 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from llama-index-core<0.12.0,>=0.11.0->llama-index-readers-file) (1.2.14)\n",
            "Requirement already satisfied: dirtyjson<2.0.0,>=1.0.8 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from llama-index-core<0.12.0,>=0.11.0->llama-index-readers-file) (1.0.8)\n",
            "Requirement already satisfied: fsspec>=2023.5.0 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from llama-index-core<0.12.0,>=0.11.0->llama-index-readers-file) (2024.6.1)\n",
            "Requirement already satisfied: httpx in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from llama-index-core<0.12.0,>=0.11.0->llama-index-readers-file) (0.27.2)\n",
            "Requirement already satisfied: nest-asyncio<2.0.0,>=1.5.8 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from llama-index-core<0.12.0,>=0.11.0->llama-index-readers-file) (1.6.0)\n",
            "Requirement already satisfied: networkx>=3.0 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from llama-index-core<0.12.0,>=0.11.0->llama-index-readers-file) (3.3)\n",
            "Requirement already satisfied: nltk>3.8.1 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from llama-index-core<0.12.0,>=0.11.0->llama-index-readers-file) (3.9.1)\n",
            "Requirement already satisfied: numpy<2.0.0 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from llama-index-core<0.12.0,>=0.11.0->llama-index-readers-file) (1.26.4)\n",
            "Requirement already satisfied: pillow>=9.0.0 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from llama-index-core<0.12.0,>=0.11.0->llama-index-readers-file) (10.4.0)\n",
            "Requirement already satisfied: pydantic<3.0.0,>=2.7.0 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from llama-index-core<0.12.0,>=0.11.0->llama-index-readers-file) (2.9.1)\n",
            "Requirement already satisfied: requests>=2.31.0 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from llama-index-core<0.12.0,>=0.11.0->llama-index-readers-file) (2.32.3)\n",
            "Requirement already satisfied: tenacity!=8.4.0,<9.0.0,>=8.2.0 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from llama-index-core<0.12.0,>=0.11.0->llama-index-readers-file) (8.4.2)\n",
            "Requirement already satisfied: tiktoken>=0.3.3 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from llama-index-core<0.12.0,>=0.11.0->llama-index-readers-file) (0.7.0)\n",
            "Requirement already satisfied: tqdm<5.0.0,>=4.66.1 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from llama-index-core<0.12.0,>=0.11.0->llama-index-readers-file) (4.66.5)\n",
            "Requirement already satisfied: typing-extensions>=4.5.0 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from llama-index-core<0.12.0,>=0.11.0->llama-index-readers-file) (4.12.2)\n",
            "Requirement already satisfied: typing-inspect>=0.8.0 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from llama-index-core<0.12.0,>=0.11.0->llama-index-readers-file) (0.9.0)\n",
            "Requirement already satisfied: wrapt in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from llama-index-core<0.12.0,>=0.11.0->llama-index-readers-file) (1.16.0)\n",
            "Requirement already satisfied: python-dateutil>=2.8.2 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from pandas->llama-index-readers-file) (2.9.0)\n",
            "Requirement already satisfied: pytz>=2020.1 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from pandas->llama-index-readers-file) (2024.1)\n",
            "Requirement already satisfied: tzdata>=2022.7 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from pandas->llama-index-readers-file) (2024.1)\n",
            "Requirement already satisfied: aiohappyeyeballs>=2.3.0 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from aiohttp<4.0.0,>=3.8.6->llama-index-core<0.12.0,>=0.11.0->llama-index-readers-file) (2.4.0)\n",
            "Requirement already satisfied: aiosignal>=1.1.2 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from aiohttp<4.0.0,>=3.8.6->llama-index-core<0.12.0,>=0.11.0->llama-index-readers-file) (1.3.1)\n",
            "Requirement already satisfied: attrs>=17.3.0 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from aiohttp<4.0.0,>=3.8.6->llama-index-core<0.12.0,>=0.11.0->llama-index-readers-file) (24.2.0)\n",
            "Requirement already satisfied: frozenlist>=1.1.1 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from aiohttp<4.0.0,>=3.8.6->llama-index-core<0.12.0,>=0.11.0->llama-index-readers-file) (1.4.1)\n",
            "Requirement already satisfied: multidict<7.0,>=4.5 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from aiohttp<4.0.0,>=3.8.6->llama-index-core<0.12.0,>=0.11.0->llama-index-readers-file) (6.0.5)\n",
            "Requirement already satisfied: yarl<2.0,>=1.0 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from aiohttp<4.0.0,>=3.8.6->llama-index-core<0.12.0,>=0.11.0->llama-index-readers-file) (1.11.0)\n",
            "Requirement already satisfied: async-timeout<5.0,>=4.0 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from aiohttp<4.0.0,>=3.8.6->llama-index-core<0.12.0,>=0.11.0->llama-index-readers-file) (4.0.3)\n",
            "Requirement already satisfied: click in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from nltk>3.8.1->llama-index-core<0.12.0,>=0.11.0->llama-index-readers-file) (8.1.7)\n",
            "Requirement already satisfied: joblib in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from nltk>3.8.1->llama-index-core<0.12.0,>=0.11.0->llama-index-readers-file) (1.4.2)\n",
            "Requirement already satisfied: regex>=2021.8.3 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from nltk>3.8.1->llama-index-core<0.12.0,>=0.11.0->llama-index-readers-file) (2024.7.24)\n",
            "Requirement already satisfied: annotated-types>=0.6.0 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from pydantic<3.0.0,>=2.7.0->llama-index-core<0.12.0,>=0.11.0->llama-index-readers-file) (0.7.0)\n",
            "Requirement already satisfied: pydantic-core==2.23.3 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from pydantic<3.0.0,>=2.7.0->llama-index-core<0.12.0,>=0.11.0->llama-index-readers-file) (2.23.3)\n",
            "Requirement already satisfied: six>=1.5 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from python-dateutil>=2.8.2->pandas->llama-index-readers-file) (1.16.0)\n",
            "Requirement already satisfied: charset-normalizer<4,>=2 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from requests>=2.31.0->llama-index-core<0.12.0,>=0.11.0->llama-index-readers-file) (3.3.2)\n",
            "Requirement already satisfied: idna<4,>=2.5 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from requests>=2.31.0->llama-index-core<0.12.0,>=0.11.0->llama-index-readers-file) (3.8)\n",
            "Requirement already satisfied: urllib3<3,>=1.21.1 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from requests>=2.31.0->llama-index-core<0.12.0,>=0.11.0->llama-index-readers-file) (2.2.2)\n",
            "Requirement already satisfied: certifi>=2017.4.17 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from requests>=2.31.0->llama-index-core<0.12.0,>=0.11.0->llama-index-readers-file) (2024.8.30)\n",
            "Requirement already satisfied: greenlet!=0.4.17 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from SQLAlchemy>=1.4.49->SQLAlchemy[asyncio]>=1.4.49->llama-index-core<0.12.0,>=0.11.0->llama-index-readers-file) (3.0.3)\n",
            "Requirement already satisfied: mypy-extensions>=0.3.0 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from typing-inspect>=0.8.0->llama-index-core<0.12.0,>=0.11.0->llama-index-readers-file) (1.0.0)\n",
            "Requirement already satisfied: marshmallow<4.0.0,>=3.18.0 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from dataclasses-json->llama-index-core<0.12.0,>=0.11.0->llama-index-readers-file) (3.22.0)\n",
            "Requirement already satisfied: anyio in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from httpx->llama-index-core<0.12.0,>=0.11.0->llama-index-readers-file) (4.4.0)\n",
            "Requirement already satisfied: httpcore==1.* in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from httpx->llama-index-core<0.12.0,>=0.11.0->llama-index-readers-file) (1.0.5)\n",
            "Requirement already satisfied: sniffio in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from httpx->llama-index-core<0.12.0,>=0.11.0->llama-index-readers-file) (1.3.1)\n",
            "Requirement already satisfied: h11<0.15,>=0.13 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from httpcore==1.*->httpx->llama-index-core<0.12.0,>=0.11.0->llama-index-readers-file) (0.14.0)\n",
            "Requirement already satisfied: packaging>=17.0 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from marshmallow<4.0.0,>=3.18.0->dataclasses-json->llama-index-core<0.12.0,>=0.11.0->llama-index-readers-file) (23.2)\n",
            "Requirement already satisfied: exceptiongroup>=1.0.2 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from anyio->httpx->llama-index-core<0.12.0,>=0.11.0->llama-index-readers-file) (1.2.2)\n",
            "Requirement already satisfied: llama-index-embeddings-fastembed in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (0.2.0)\n",
            "Requirement already satisfied: fastembed>=0.2.2 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from llama-index-embeddings-fastembed) (0.3.6)\n",
            "Requirement already satisfied: llama-index-core<0.12.0,>=0.11.0 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from llama-index-embeddings-fastembed) (0.11.10)\n",
            "Requirement already satisfied: PyStemmer<3.0.0,>=2.2.0 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from fastembed>=0.2.2->llama-index-embeddings-fastembed) (2.2.0.1)\n",
            "Requirement already satisfied: huggingface-hub<1.0,>=0.20 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from fastembed>=0.2.2->llama-index-embeddings-fastembed) (0.24.6)\n",
            "Requirement already satisfied: loguru<0.8.0,>=0.7.2 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from fastembed>=0.2.2->llama-index-embeddings-fastembed) (0.7.2)\n",
            "Requirement already satisfied: mmh3<5.0,>=4.0 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from fastembed>=0.2.2->llama-index-embeddings-fastembed) (4.1.0)\n",
            "Requirement already satisfied: numpy<2,>=1.21 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from fastembed>=0.2.2->llama-index-embeddings-fastembed) (1.26.4)\n",
            "Requirement already satisfied: onnx<2.0.0,>=1.15.0 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from fastembed>=0.2.2->llama-index-embeddings-fastembed) (1.16.2)\n",
            "Requirement already satisfied: onnxruntime<2.0.0,>=1.17.0 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from fastembed>=0.2.2->llama-index-embeddings-fastembed) (1.19.2)\n",
            "Requirement already satisfied: pillow<11.0.0,>=10.3.0 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from fastembed>=0.2.2->llama-index-embeddings-fastembed) (10.4.0)\n",
            "Requirement already satisfied: requests<3.0,>=2.31 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from fastembed>=0.2.2->llama-index-embeddings-fastembed) (2.32.3)\n",
            "Requirement already satisfied: snowballstemmer<3.0.0,>=2.2.0 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from fastembed>=0.2.2->llama-index-embeddings-fastembed) (2.2.0)\n",
            "Requirement already satisfied: tokenizers<1.0,>=0.15 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from fastembed>=0.2.2->llama-index-embeddings-fastembed) (0.19.1)\n",
            "Requirement already satisfied: tqdm<5.0,>=4.66 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from fastembed>=0.2.2->llama-index-embeddings-fastembed) (4.66.5)\n",
            "Requirement already satisfied: PyYAML>=6.0.1 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from llama-index-core<0.12.0,>=0.11.0->llama-index-embeddings-fastembed) (6.0.2)\n",
            "Requirement already satisfied: SQLAlchemy>=1.4.49 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from SQLAlchemy[asyncio]>=1.4.49->llama-index-core<0.12.0,>=0.11.0->llama-index-embeddings-fastembed) (2.0.34)\n",
            "Requirement already satisfied: aiohttp<4.0.0,>=3.8.6 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from llama-index-core<0.12.0,>=0.11.0->llama-index-embeddings-fastembed) (3.10.5)\n",
            "Requirement already satisfied: dataclasses-json in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from llama-index-core<0.12.0,>=0.11.0->llama-index-embeddings-fastembed) (0.5.14)\n",
            "Requirement already satisfied: deprecated>=1.2.9.3 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from llama-index-core<0.12.0,>=0.11.0->llama-index-embeddings-fastembed) (1.2.14)\n",
            "Requirement already satisfied: dirtyjson<2.0.0,>=1.0.8 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from llama-index-core<0.12.0,>=0.11.0->llama-index-embeddings-fastembed) (1.0.8)\n",
            "Requirement already satisfied: fsspec>=2023.5.0 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from llama-index-core<0.12.0,>=0.11.0->llama-index-embeddings-fastembed) (2024.6.1)\n",
            "Requirement already satisfied: httpx in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from llama-index-core<0.12.0,>=0.11.0->llama-index-embeddings-fastembed) (0.27.2)\n",
            "Requirement already satisfied: nest-asyncio<2.0.0,>=1.5.8 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from llama-index-core<0.12.0,>=0.11.0->llama-index-embeddings-fastembed) (1.6.0)\n",
            "Requirement already satisfied: networkx>=3.0 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from llama-index-core<0.12.0,>=0.11.0->llama-index-embeddings-fastembed) (3.3)\n",
            "Requirement already satisfied: nltk>3.8.1 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from llama-index-core<0.12.0,>=0.11.0->llama-index-embeddings-fastembed) (3.9.1)\n",
            "Requirement already satisfied: pydantic<3.0.0,>=2.7.0 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from llama-index-core<0.12.0,>=0.11.0->llama-index-embeddings-fastembed) (2.9.1)\n",
            "Requirement already satisfied: tenacity!=8.4.0,<9.0.0,>=8.2.0 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from llama-index-core<0.12.0,>=0.11.0->llama-index-embeddings-fastembed) (8.4.2)\n",
            "Requirement already satisfied: tiktoken>=0.3.3 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from llama-index-core<0.12.0,>=0.11.0->llama-index-embeddings-fastembed) (0.7.0)\n",
            "Requirement already satisfied: typing-extensions>=4.5.0 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from llama-index-core<0.12.0,>=0.11.0->llama-index-embeddings-fastembed) (4.12.2)\n",
            "Requirement already satisfied: typing-inspect>=0.8.0 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from llama-index-core<0.12.0,>=0.11.0->llama-index-embeddings-fastembed) (0.9.0)\n",
            "Requirement already satisfied: wrapt in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from llama-index-core<0.12.0,>=0.11.0->llama-index-embeddings-fastembed) (1.16.0)\n",
            "Requirement already satisfied: aiohappyeyeballs>=2.3.0 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from aiohttp<4.0.0,>=3.8.6->llama-index-core<0.12.0,>=0.11.0->llama-index-embeddings-fastembed) (2.4.0)\n",
            "Requirement already satisfied: aiosignal>=1.1.2 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from aiohttp<4.0.0,>=3.8.6->llama-index-core<0.12.0,>=0.11.0->llama-index-embeddings-fastembed) (1.3.1)\n",
            "Requirement already satisfied: attrs>=17.3.0 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from aiohttp<4.0.0,>=3.8.6->llama-index-core<0.12.0,>=0.11.0->llama-index-embeddings-fastembed) (24.2.0)\n",
            "Requirement already satisfied: frozenlist>=1.1.1 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from aiohttp<4.0.0,>=3.8.6->llama-index-core<0.12.0,>=0.11.0->llama-index-embeddings-fastembed) (1.4.1)\n",
            "Requirement already satisfied: multidict<7.0,>=4.5 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from aiohttp<4.0.0,>=3.8.6->llama-index-core<0.12.0,>=0.11.0->llama-index-embeddings-fastembed) (6.0.5)\n",
            "Requirement already satisfied: yarl<2.0,>=1.0 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from aiohttp<4.0.0,>=3.8.6->llama-index-core<0.12.0,>=0.11.0->llama-index-embeddings-fastembed) (1.11.0)\n",
            "Requirement already satisfied: async-timeout<5.0,>=4.0 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from aiohttp<4.0.0,>=3.8.6->llama-index-core<0.12.0,>=0.11.0->llama-index-embeddings-fastembed) (4.0.3)\n",
            "Requirement already satisfied: filelock in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from huggingface-hub<1.0,>=0.20->fastembed>=0.2.2->llama-index-embeddings-fastembed) (3.16.0)\n",
            "Requirement already satisfied: packaging>=20.9 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from huggingface-hub<1.0,>=0.20->fastembed>=0.2.2->llama-index-embeddings-fastembed) (23.2)\n",
            "Requirement already satisfied: click in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from nltk>3.8.1->llama-index-core<0.12.0,>=0.11.0->llama-index-embeddings-fastembed) (8.1.7)\n",
            "Requirement already satisfied: joblib in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from nltk>3.8.1->llama-index-core<0.12.0,>=0.11.0->llama-index-embeddings-fastembed) (1.4.2)\n",
            "Requirement already satisfied: regex>=2021.8.3 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from nltk>3.8.1->llama-index-core<0.12.0,>=0.11.0->llama-index-embeddings-fastembed) (2024.7.24)\n",
            "Requirement already satisfied: protobuf>=3.20.2 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from onnx<2.0.0,>=1.15.0->fastembed>=0.2.2->llama-index-embeddings-fastembed) (4.25.4)\n",
            "Requirement already satisfied: coloredlogs in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from onnxruntime<2.0.0,>=1.17.0->fastembed>=0.2.2->llama-index-embeddings-fastembed) (15.0.1)\n",
            "Requirement already satisfied: flatbuffers in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from onnxruntime<2.0.0,>=1.17.0->fastembed>=0.2.2->llama-index-embeddings-fastembed) (24.3.25)\n",
            "Requirement already satisfied: sympy in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from onnxruntime<2.0.0,>=1.17.0->fastembed>=0.2.2->llama-index-embeddings-fastembed) (1.13.2)\n",
            "Requirement already satisfied: annotated-types>=0.6.0 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from pydantic<3.0.0,>=2.7.0->llama-index-core<0.12.0,>=0.11.0->llama-index-embeddings-fastembed) (0.7.0)\n",
            "Requirement already satisfied: pydantic-core==2.23.3 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from pydantic<3.0.0,>=2.7.0->llama-index-core<0.12.0,>=0.11.0->llama-index-embeddings-fastembed) (2.23.3)\n",
            "Requirement already satisfied: charset-normalizer<4,>=2 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from requests<3.0,>=2.31->fastembed>=0.2.2->llama-index-embeddings-fastembed) (3.3.2)\n",
            "Requirement already satisfied: idna<4,>=2.5 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from requests<3.0,>=2.31->fastembed>=0.2.2->llama-index-embeddings-fastembed) (3.8)\n",
            "Requirement already satisfied: urllib3<3,>=1.21.1 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from requests<3.0,>=2.31->fastembed>=0.2.2->llama-index-embeddings-fastembed) (2.2.2)\n",
            "Requirement already satisfied: certifi>=2017.4.17 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from requests<3.0,>=2.31->fastembed>=0.2.2->llama-index-embeddings-fastembed) (2024.8.30)\n",
            "Requirement already satisfied: greenlet!=0.4.17 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from SQLAlchemy>=1.4.49->SQLAlchemy[asyncio]>=1.4.49->llama-index-core<0.12.0,>=0.11.0->llama-index-embeddings-fastembed) (3.0.3)\n",
            "Requirement already satisfied: mypy-extensions>=0.3.0 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from typing-inspect>=0.8.0->llama-index-core<0.12.0,>=0.11.0->llama-index-embeddings-fastembed) (1.0.0)\n",
            "Requirement already satisfied: marshmallow<4.0.0,>=3.18.0 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from dataclasses-json->llama-index-core<0.12.0,>=0.11.0->llama-index-embeddings-fastembed) (3.22.0)\n",
            "Requirement already satisfied: anyio in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from httpx->llama-index-core<0.12.0,>=0.11.0->llama-index-embeddings-fastembed) (4.4.0)\n",
            "Requirement already satisfied: httpcore==1.* in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from httpx->llama-index-core<0.12.0,>=0.11.0->llama-index-embeddings-fastembed) (1.0.5)\n",
            "Requirement already satisfied: sniffio in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from httpx->llama-index-core<0.12.0,>=0.11.0->llama-index-embeddings-fastembed) (1.3.1)\n",
            "Requirement already satisfied: h11<0.15,>=0.13 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from httpcore==1.*->httpx->llama-index-core<0.12.0,>=0.11.0->llama-index-embeddings-fastembed) (0.14.0)\n",
            "Requirement already satisfied: exceptiongroup>=1.0.2 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from anyio->httpx->llama-index-core<0.12.0,>=0.11.0->llama-index-embeddings-fastembed) (1.2.2)\n",
            "Requirement already satisfied: humanfriendly>=9.1 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from coloredlogs->onnxruntime<2.0.0,>=1.17.0->fastembed>=0.2.2->llama-index-embeddings-fastembed) (10.0)\n",
            "Requirement already satisfied: mpmath<1.4,>=1.1.0 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from sympy->onnxruntime<2.0.0,>=1.17.0->fastembed>=0.2.2->llama-index-embeddings-fastembed) (1.3.0)\n",
            "Requirement already satisfied: llama-index-llms-openai in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (0.2.9)\n",
            "Requirement already satisfied: llama-index-core<0.12.0,>=0.11.7 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from llama-index-llms-openai) (0.11.10)\n",
            "Requirement already satisfied: openai<2.0.0,>=1.40.0 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from llama-index-llms-openai) (1.44.0)\n",
            "Requirement already satisfied: PyYAML>=6.0.1 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from llama-index-core<0.12.0,>=0.11.7->llama-index-llms-openai) (6.0.2)\n",
            "Requirement already satisfied: SQLAlchemy>=1.4.49 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from SQLAlchemy[asyncio]>=1.4.49->llama-index-core<0.12.0,>=0.11.7->llama-index-llms-openai) (2.0.34)\n",
            "Requirement already satisfied: aiohttp<4.0.0,>=3.8.6 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from llama-index-core<0.12.0,>=0.11.7->llama-index-llms-openai) (3.10.5)\n",
            "Requirement already satisfied: dataclasses-json in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from llama-index-core<0.12.0,>=0.11.7->llama-index-llms-openai) (0.5.14)\n",
            "Requirement already satisfied: deprecated>=1.2.9.3 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from llama-index-core<0.12.0,>=0.11.7->llama-index-llms-openai) (1.2.14)\n",
            "Requirement already satisfied: dirtyjson<2.0.0,>=1.0.8 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from llama-index-core<0.12.0,>=0.11.7->llama-index-llms-openai) (1.0.8)\n",
            "Requirement already satisfied: fsspec>=2023.5.0 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from llama-index-core<0.12.0,>=0.11.7->llama-index-llms-openai) (2024.6.1)\n",
            "Requirement already satisfied: httpx in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from llama-index-core<0.12.0,>=0.11.7->llama-index-llms-openai) (0.27.2)\n",
            "Requirement already satisfied: nest-asyncio<2.0.0,>=1.5.8 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from llama-index-core<0.12.0,>=0.11.7->llama-index-llms-openai) (1.6.0)\n",
            "Requirement already satisfied: networkx>=3.0 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from llama-index-core<0.12.0,>=0.11.7->llama-index-llms-openai) (3.3)\n",
            "Requirement already satisfied: nltk>3.8.1 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from llama-index-core<0.12.0,>=0.11.7->llama-index-llms-openai) (3.9.1)\n",
            "Requirement already satisfied: numpy<2.0.0 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from llama-index-core<0.12.0,>=0.11.7->llama-index-llms-openai) (1.26.4)\n",
            "Requirement already satisfied: pillow>=9.0.0 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from llama-index-core<0.12.0,>=0.11.7->llama-index-llms-openai) (10.4.0)\n",
            "Requirement already satisfied: pydantic<3.0.0,>=2.7.0 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from llama-index-core<0.12.0,>=0.11.7->llama-index-llms-openai) (2.9.1)\n",
            "Requirement already satisfied: requests>=2.31.0 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from llama-index-core<0.12.0,>=0.11.7->llama-index-llms-openai) (2.32.3)\n",
            "Requirement already satisfied: tenacity!=8.4.0,<9.0.0,>=8.2.0 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from llama-index-core<0.12.0,>=0.11.7->llama-index-llms-openai) (8.4.2)\n",
            "Requirement already satisfied: tiktoken>=0.3.3 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from llama-index-core<0.12.0,>=0.11.7->llama-index-llms-openai) (0.7.0)\n",
            "Requirement already satisfied: tqdm<5.0.0,>=4.66.1 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from llama-index-core<0.12.0,>=0.11.7->llama-index-llms-openai) (4.66.5)\n",
            "Requirement already satisfied: typing-extensions>=4.5.0 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from llama-index-core<0.12.0,>=0.11.7->llama-index-llms-openai) (4.12.2)\n",
            "Requirement already satisfied: typing-inspect>=0.8.0 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from llama-index-core<0.12.0,>=0.11.7->llama-index-llms-openai) (0.9.0)\n",
            "Requirement already satisfied: wrapt in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from llama-index-core<0.12.0,>=0.11.7->llama-index-llms-openai) (1.16.0)\n",
            "Requirement already satisfied: anyio<5,>=3.5.0 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from openai<2.0.0,>=1.40.0->llama-index-llms-openai) (4.4.0)\n",
            "Requirement already satisfied: distro<2,>=1.7.0 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from openai<2.0.0,>=1.40.0->llama-index-llms-openai) (1.9.0)\n",
            "Requirement already satisfied: jiter<1,>=0.4.0 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from openai<2.0.0,>=1.40.0->llama-index-llms-openai) (0.5.0)\n",
            "Requirement already satisfied: sniffio in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from openai<2.0.0,>=1.40.0->llama-index-llms-openai) (1.3.1)\n",
            "Requirement already satisfied: aiohappyeyeballs>=2.3.0 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from aiohttp<4.0.0,>=3.8.6->llama-index-core<0.12.0,>=0.11.7->llama-index-llms-openai) (2.4.0)\n",
            "Requirement already satisfied: aiosignal>=1.1.2 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from aiohttp<4.0.0,>=3.8.6->llama-index-core<0.12.0,>=0.11.7->llama-index-llms-openai) (1.3.1)\n",
            "Requirement already satisfied: attrs>=17.3.0 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from aiohttp<4.0.0,>=3.8.6->llama-index-core<0.12.0,>=0.11.7->llama-index-llms-openai) (24.2.0)\n",
            "Requirement already satisfied: frozenlist>=1.1.1 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from aiohttp<4.0.0,>=3.8.6->llama-index-core<0.12.0,>=0.11.7->llama-index-llms-openai) (1.4.1)\n",
            "Requirement already satisfied: multidict<7.0,>=4.5 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from aiohttp<4.0.0,>=3.8.6->llama-index-core<0.12.0,>=0.11.7->llama-index-llms-openai) (6.0.5)\n",
            "Requirement already satisfied: yarl<2.0,>=1.0 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from aiohttp<4.0.0,>=3.8.6->llama-index-core<0.12.0,>=0.11.7->llama-index-llms-openai) (1.11.0)\n",
            "Requirement already satisfied: async-timeout<5.0,>=4.0 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from aiohttp<4.0.0,>=3.8.6->llama-index-core<0.12.0,>=0.11.7->llama-index-llms-openai) (4.0.3)\n",
            "Requirement already satisfied: idna>=2.8 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from anyio<5,>=3.5.0->openai<2.0.0,>=1.40.0->llama-index-llms-openai) (3.8)\n",
            "Requirement already satisfied: exceptiongroup>=1.0.2 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from anyio<5,>=3.5.0->openai<2.0.0,>=1.40.0->llama-index-llms-openai) (1.2.2)\n",
            "Requirement already satisfied: certifi in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from httpx->llama-index-core<0.12.0,>=0.11.7->llama-index-llms-openai) (2024.8.30)\n",
            "Requirement already satisfied: httpcore==1.* in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from httpx->llama-index-core<0.12.0,>=0.11.7->llama-index-llms-openai) (1.0.5)\n",
            "Requirement already satisfied: h11<0.15,>=0.13 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from httpcore==1.*->httpx->llama-index-core<0.12.0,>=0.11.7->llama-index-llms-openai) (0.14.0)\n",
            "Requirement already satisfied: click in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from nltk>3.8.1->llama-index-core<0.12.0,>=0.11.7->llama-index-llms-openai) (8.1.7)\n",
            "Requirement already satisfied: joblib in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from nltk>3.8.1->llama-index-core<0.12.0,>=0.11.7->llama-index-llms-openai) (1.4.2)\n",
            "Requirement already satisfied: regex>=2021.8.3 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from nltk>3.8.1->llama-index-core<0.12.0,>=0.11.7->llama-index-llms-openai) (2024.7.24)\n",
            "Requirement already satisfied: annotated-types>=0.6.0 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from pydantic<3.0.0,>=2.7.0->llama-index-core<0.12.0,>=0.11.7->llama-index-llms-openai) (0.7.0)\n",
            "Requirement already satisfied: pydantic-core==2.23.3 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from pydantic<3.0.0,>=2.7.0->llama-index-core<0.12.0,>=0.11.7->llama-index-llms-openai) (2.23.3)\n",
            "Requirement already satisfied: charset-normalizer<4,>=2 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from requests>=2.31.0->llama-index-core<0.12.0,>=0.11.7->llama-index-llms-openai) (3.3.2)\n",
            "Requirement already satisfied: urllib3<3,>=1.21.1 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from requests>=2.31.0->llama-index-core<0.12.0,>=0.11.7->llama-index-llms-openai) (2.2.2)\n",
            "Requirement already satisfied: greenlet!=0.4.17 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from SQLAlchemy>=1.4.49->SQLAlchemy[asyncio]>=1.4.49->llama-index-core<0.12.0,>=0.11.7->llama-index-llms-openai) (3.0.3)\n",
            "Requirement already satisfied: mypy-extensions>=0.3.0 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from typing-inspect>=0.8.0->llama-index-core<0.12.0,>=0.11.7->llama-index-llms-openai) (1.0.0)\n",
            "Requirement already satisfied: marshmallow<4.0.0,>=3.18.0 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from dataclasses-json->llama-index-core<0.12.0,>=0.11.7->llama-index-llms-openai) (3.22.0)\n",
            "Requirement already satisfied: packaging>=17.0 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from marshmallow<4.0.0,>=3.18.0->dataclasses-json->llama-index-core<0.12.0,>=0.11.7->llama-index-llms-openai) (23.2)\n",
            "Requirement already satisfied: llama-index-llms-groq in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (0.2.0)\n",
            "Requirement already satisfied: llama-index-core<0.12.0,>=0.11.0 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from llama-index-llms-groq) (0.11.10)\n",
            "Requirement already satisfied: llama-index-llms-openai-like<0.3.0,>=0.2.0 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from llama-index-llms-groq) (0.2.0)\n",
            "Requirement already satisfied: PyYAML>=6.0.1 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from llama-index-core<0.12.0,>=0.11.0->llama-index-llms-groq) (6.0.2)\n",
            "Requirement already satisfied: SQLAlchemy>=1.4.49 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from SQLAlchemy[asyncio]>=1.4.49->llama-index-core<0.12.0,>=0.11.0->llama-index-llms-groq) (2.0.34)\n",
            "Requirement already satisfied: aiohttp<4.0.0,>=3.8.6 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from llama-index-core<0.12.0,>=0.11.0->llama-index-llms-groq) (3.10.5)\n",
            "Requirement already satisfied: dataclasses-json in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from llama-index-core<0.12.0,>=0.11.0->llama-index-llms-groq) (0.5.14)\n",
            "Requirement already satisfied: deprecated>=1.2.9.3 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from llama-index-core<0.12.0,>=0.11.0->llama-index-llms-groq) (1.2.14)\n",
            "Requirement already satisfied: dirtyjson<2.0.0,>=1.0.8 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from llama-index-core<0.12.0,>=0.11.0->llama-index-llms-groq) (1.0.8)\n",
            "Requirement already satisfied: fsspec>=2023.5.0 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from llama-index-core<0.12.0,>=0.11.0->llama-index-llms-groq) (2024.6.1)\n",
            "Requirement already satisfied: httpx in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from llama-index-core<0.12.0,>=0.11.0->llama-index-llms-groq) (0.27.2)\n",
            "Requirement already satisfied: nest-asyncio<2.0.0,>=1.5.8 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from llama-index-core<0.12.0,>=0.11.0->llama-index-llms-groq) (1.6.0)\n",
            "Requirement already satisfied: networkx>=3.0 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from llama-index-core<0.12.0,>=0.11.0->llama-index-llms-groq) (3.3)\n",
            "Requirement already satisfied: nltk>3.8.1 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from llama-index-core<0.12.0,>=0.11.0->llama-index-llms-groq) (3.9.1)\n",
            "Requirement already satisfied: numpy<2.0.0 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from llama-index-core<0.12.0,>=0.11.0->llama-index-llms-groq) (1.26.4)\n",
            "Requirement already satisfied: pillow>=9.0.0 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from llama-index-core<0.12.0,>=0.11.0->llama-index-llms-groq) (10.4.0)\n",
            "Requirement already satisfied: pydantic<3.0.0,>=2.7.0 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from llama-index-core<0.12.0,>=0.11.0->llama-index-llms-groq) (2.9.1)\n",
            "Requirement already satisfied: requests>=2.31.0 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from llama-index-core<0.12.0,>=0.11.0->llama-index-llms-groq) (2.32.3)\n",
            "Requirement already satisfied: tenacity!=8.4.0,<9.0.0,>=8.2.0 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from llama-index-core<0.12.0,>=0.11.0->llama-index-llms-groq) (8.4.2)\n",
            "Requirement already satisfied: tiktoken>=0.3.3 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from llama-index-core<0.12.0,>=0.11.0->llama-index-llms-groq) (0.7.0)\n",
            "Requirement already satisfied: tqdm<5.0.0,>=4.66.1 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from llama-index-core<0.12.0,>=0.11.0->llama-index-llms-groq) (4.66.5)\n",
            "Requirement already satisfied: typing-extensions>=4.5.0 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from llama-index-core<0.12.0,>=0.11.0->llama-index-llms-groq) (4.12.2)\n",
            "Requirement already satisfied: typing-inspect>=0.8.0 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from llama-index-core<0.12.0,>=0.11.0->llama-index-llms-groq) (0.9.0)\n",
            "Requirement already satisfied: wrapt in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from llama-index-core<0.12.0,>=0.11.0->llama-index-llms-groq) (1.16.0)\n",
            "Requirement already satisfied: llama-index-llms-openai<0.3.0,>=0.2.0 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from llama-index-llms-openai-like<0.3.0,>=0.2.0->llama-index-llms-groq) (0.2.9)\n",
            "Requirement already satisfied: transformers<5.0.0,>=4.37.0 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from llama-index-llms-openai-like<0.3.0,>=0.2.0->llama-index-llms-groq) (4.44.2)\n",
            "Requirement already satisfied: aiohappyeyeballs>=2.3.0 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from aiohttp<4.0.0,>=3.8.6->llama-index-core<0.12.0,>=0.11.0->llama-index-llms-groq) (2.4.0)\n",
            "Requirement already satisfied: aiosignal>=1.1.2 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from aiohttp<4.0.0,>=3.8.6->llama-index-core<0.12.0,>=0.11.0->llama-index-llms-groq) (1.3.1)\n",
            "Requirement already satisfied: attrs>=17.3.0 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from aiohttp<4.0.0,>=3.8.6->llama-index-core<0.12.0,>=0.11.0->llama-index-llms-groq) (24.2.0)\n",
            "Requirement already satisfied: frozenlist>=1.1.1 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from aiohttp<4.0.0,>=3.8.6->llama-index-core<0.12.0,>=0.11.0->llama-index-llms-groq) (1.4.1)\n",
            "Requirement already satisfied: multidict<7.0,>=4.5 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from aiohttp<4.0.0,>=3.8.6->llama-index-core<0.12.0,>=0.11.0->llama-index-llms-groq) (6.0.5)\n",
            "Requirement already satisfied: yarl<2.0,>=1.0 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from aiohttp<4.0.0,>=3.8.6->llama-index-core<0.12.0,>=0.11.0->llama-index-llms-groq) (1.11.0)\n",
            "Requirement already satisfied: async-timeout<5.0,>=4.0 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from aiohttp<4.0.0,>=3.8.6->llama-index-core<0.12.0,>=0.11.0->llama-index-llms-groq) (4.0.3)\n",
            "Requirement already satisfied: openai<2.0.0,>=1.40.0 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from llama-index-llms-openai<0.3.0,>=0.2.0->llama-index-llms-openai-like<0.3.0,>=0.2.0->llama-index-llms-groq) (1.44.0)\n",
            "Requirement already satisfied: click in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from nltk>3.8.1->llama-index-core<0.12.0,>=0.11.0->llama-index-llms-groq) (8.1.7)\n",
            "Requirement already satisfied: joblib in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from nltk>3.8.1->llama-index-core<0.12.0,>=0.11.0->llama-index-llms-groq) (1.4.2)\n",
            "Requirement already satisfied: regex>=2021.8.3 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from nltk>3.8.1->llama-index-core<0.12.0,>=0.11.0->llama-index-llms-groq) (2024.7.24)\n",
            "Requirement already satisfied: annotated-types>=0.6.0 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from pydantic<3.0.0,>=2.7.0->llama-index-core<0.12.0,>=0.11.0->llama-index-llms-groq) (0.7.0)\n",
            "Requirement already satisfied: pydantic-core==2.23.3 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from pydantic<3.0.0,>=2.7.0->llama-index-core<0.12.0,>=0.11.0->llama-index-llms-groq) (2.23.3)\n",
            "Requirement already satisfied: charset-normalizer<4,>=2 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from requests>=2.31.0->llama-index-core<0.12.0,>=0.11.0->llama-index-llms-groq) (3.3.2)\n",
            "Requirement already satisfied: idna<4,>=2.5 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from requests>=2.31.0->llama-index-core<0.12.0,>=0.11.0->llama-index-llms-groq) (3.8)\n",
            "Requirement already satisfied: urllib3<3,>=1.21.1 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from requests>=2.31.0->llama-index-core<0.12.0,>=0.11.0->llama-index-llms-groq) (2.2.2)\n",
            "Requirement already satisfied: certifi>=2017.4.17 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from requests>=2.31.0->llama-index-core<0.12.0,>=0.11.0->llama-index-llms-groq) (2024.8.30)\n",
            "Requirement already satisfied: greenlet!=0.4.17 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from SQLAlchemy>=1.4.49->SQLAlchemy[asyncio]>=1.4.49->llama-index-core<0.12.0,>=0.11.0->llama-index-llms-groq) (3.0.3)\n",
            "Requirement already satisfied: filelock in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from transformers<5.0.0,>=4.37.0->llama-index-llms-openai-like<0.3.0,>=0.2.0->llama-index-llms-groq) (3.16.0)\n",
            "Requirement already satisfied: huggingface-hub<1.0,>=0.23.2 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from transformers<5.0.0,>=4.37.0->llama-index-llms-openai-like<0.3.0,>=0.2.0->llama-index-llms-groq) (0.24.6)\n",
            "Requirement already satisfied: packaging>=20.0 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from transformers<5.0.0,>=4.37.0->llama-index-llms-openai-like<0.3.0,>=0.2.0->llama-index-llms-groq) (23.2)\n",
            "Requirement already satisfied: safetensors>=0.4.1 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from transformers<5.0.0,>=4.37.0->llama-index-llms-openai-like<0.3.0,>=0.2.0->llama-index-llms-groq) (0.4.5)\n",
            "Requirement already satisfied: tokenizers<0.20,>=0.19 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from transformers<5.0.0,>=4.37.0->llama-index-llms-openai-like<0.3.0,>=0.2.0->llama-index-llms-groq) (0.19.1)\n",
            "Requirement already satisfied: mypy-extensions>=0.3.0 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from typing-inspect>=0.8.0->llama-index-core<0.12.0,>=0.11.0->llama-index-llms-groq) (1.0.0)\n",
            "Requirement already satisfied: marshmallow<4.0.0,>=3.18.0 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from dataclasses-json->llama-index-core<0.12.0,>=0.11.0->llama-index-llms-groq) (3.22.0)\n",
            "Requirement already satisfied: anyio in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from httpx->llama-index-core<0.12.0,>=0.11.0->llama-index-llms-groq) (4.4.0)\n",
            "Requirement already satisfied: httpcore==1.* in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from httpx->llama-index-core<0.12.0,>=0.11.0->llama-index-llms-groq) (1.0.5)\n",
            "Requirement already satisfied: sniffio in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from httpx->llama-index-core<0.12.0,>=0.11.0->llama-index-llms-groq) (1.3.1)\n",
            "Requirement already satisfied: h11<0.15,>=0.13 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from httpcore==1.*->httpx->llama-index-core<0.12.0,>=0.11.0->llama-index-llms-groq) (0.14.0)\n",
            "Requirement already satisfied: distro<2,>=1.7.0 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from openai<2.0.0,>=1.40.0->llama-index-llms-openai<0.3.0,>=0.2.0->llama-index-llms-openai-like<0.3.0,>=0.2.0->llama-index-llms-groq) (1.9.0)\n",
            "Requirement already satisfied: jiter<1,>=0.4.0 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from openai<2.0.0,>=1.40.0->llama-index-llms-openai<0.3.0,>=0.2.0->llama-index-llms-openai-like<0.3.0,>=0.2.0->llama-index-llms-groq) (0.5.0)\n",
            "Requirement already satisfied: exceptiongroup>=1.0.2 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from anyio->httpx->llama-index-core<0.12.0,>=0.11.0->llama-index-llms-groq) (1.2.2)\n",
            "Requirement already satisfied: qdrant_client in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (1.11.2)\n",
            "Requirement already satisfied: fastembed in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (0.3.6)\n",
            "Requirement already satisfied: grpcio>=1.41.0 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from qdrant_client) (1.63.2)\n",
            "Requirement already satisfied: grpcio-tools>=1.41.0 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from qdrant_client) (1.62.3)\n",
            "Requirement already satisfied: httpx>=0.20.0 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from httpx[http2]>=0.20.0->qdrant_client) (0.27.2)\n",
            "Requirement already satisfied: numpy>=1.21 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from qdrant_client) (1.26.4)\n",
            "Requirement already satisfied: portalocker<3.0.0,>=2.7.0 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from qdrant_client) (2.10.1)\n",
            "Requirement already satisfied: pydantic>=1.10.8 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from qdrant_client) (2.9.1)\n",
            "Requirement already satisfied: urllib3<3,>=1.26.14 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from qdrant_client) (2.2.2)\n",
            "Requirement already satisfied: PyStemmer<3.0.0,>=2.2.0 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from fastembed) (2.2.0.1)\n",
            "Requirement already satisfied: huggingface-hub<1.0,>=0.20 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from fastembed) (0.24.6)\n",
            "Requirement already satisfied: loguru<0.8.0,>=0.7.2 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from fastembed) (0.7.2)\n",
            "Requirement already satisfied: mmh3<5.0,>=4.0 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from fastembed) (4.1.0)\n",
            "Requirement already satisfied: onnx<2.0.0,>=1.15.0 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from fastembed) (1.16.2)\n",
            "Requirement already satisfied: onnxruntime<2.0.0,>=1.17.0 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from fastembed) (1.19.2)\n",
            "Requirement already satisfied: pillow<11.0.0,>=10.3.0 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from fastembed) (10.4.0)\n",
            "Requirement already satisfied: requests<3.0,>=2.31 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from fastembed) (2.32.3)\n",
            "Requirement already satisfied: snowballstemmer<3.0.0,>=2.2.0 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from fastembed) (2.2.0)\n",
            "Requirement already satisfied: tokenizers<1.0,>=0.15 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from fastembed) (0.19.1)\n",
            "Requirement already satisfied: tqdm<5.0,>=4.66 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from fastembed) (4.66.5)\n",
            "Requirement already satisfied: protobuf<5.0dev,>=4.21.6 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from grpcio-tools>=1.41.0->qdrant_client) (4.25.4)\n",
            "Requirement already satisfied: setuptools in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from grpcio-tools>=1.41.0->qdrant_client) (72.1.0)\n",
            "Requirement already satisfied: anyio in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from httpx>=0.20.0->httpx[http2]>=0.20.0->qdrant_client) (4.4.0)\n",
            "Requirement already satisfied: certifi in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from httpx>=0.20.0->httpx[http2]>=0.20.0->qdrant_client) (2024.8.30)\n",
            "Requirement already satisfied: httpcore==1.* in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from httpx>=0.20.0->httpx[http2]>=0.20.0->qdrant_client) (1.0.5)\n",
            "Requirement already satisfied: idna in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from httpx>=0.20.0->httpx[http2]>=0.20.0->qdrant_client) (3.8)\n",
            "Requirement already satisfied: sniffio in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from httpx>=0.20.0->httpx[http2]>=0.20.0->qdrant_client) (1.3.1)\n",
            "Requirement already satisfied: h11<0.15,>=0.13 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from httpcore==1.*->httpx>=0.20.0->httpx[http2]>=0.20.0->qdrant_client) (0.14.0)\n",
            "Requirement already satisfied: h2<5,>=3 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from httpx[http2]>=0.20.0->qdrant_client) (4.1.0)\n",
            "Requirement already satisfied: filelock in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from huggingface-hub<1.0,>=0.20->fastembed) (3.16.0)\n",
            "Requirement already satisfied: fsspec>=2023.5.0 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from huggingface-hub<1.0,>=0.20->fastembed) (2024.6.1)\n",
            "Requirement already satisfied: packaging>=20.9 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from huggingface-hub<1.0,>=0.20->fastembed) (23.2)\n",
            "Requirement already satisfied: pyyaml>=5.1 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from huggingface-hub<1.0,>=0.20->fastembed) (6.0.2)\n",
            "Requirement already satisfied: typing-extensions>=3.7.4.3 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from huggingface-hub<1.0,>=0.20->fastembed) (4.12.2)\n",
            "Requirement already satisfied: coloredlogs in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from onnxruntime<2.0.0,>=1.17.0->fastembed) (15.0.1)\n",
            "Requirement already satisfied: flatbuffers in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from onnxruntime<2.0.0,>=1.17.0->fastembed) (24.3.25)\n",
            "Requirement already satisfied: sympy in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from onnxruntime<2.0.0,>=1.17.0->fastembed) (1.13.2)\n",
            "Requirement already satisfied: annotated-types>=0.6.0 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from pydantic>=1.10.8->qdrant_client) (0.7.0)\n",
            "Requirement already satisfied: pydantic-core==2.23.3 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from pydantic>=1.10.8->qdrant_client) (2.23.3)\n",
            "Requirement already satisfied: charset-normalizer<4,>=2 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from requests<3.0,>=2.31->fastembed) (3.3.2)\n",
            "Requirement already satisfied: hyperframe<7,>=6.0 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from h2<5,>=3->httpx[http2]>=0.20.0->qdrant_client) (6.0.1)\n",
            "Requirement already satisfied: hpack<5,>=4.0 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from h2<5,>=3->httpx[http2]>=0.20.0->qdrant_client) (4.0.0)\n",
            "Requirement already satisfied: exceptiongroup>=1.0.2 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from anyio->httpx>=0.20.0->httpx[http2]>=0.20.0->qdrant_client) (1.2.2)\n",
            "Requirement already satisfied: humanfriendly>=9.1 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from coloredlogs->onnxruntime<2.0.0,>=1.17.0->fastembed) (10.0)\n",
            "Requirement already satisfied: mpmath<1.4,>=1.1.0 in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (from sympy->onnxruntime<2.0.0,>=1.17.0->fastembed) (1.3.0)\n",
            "Requirement already satisfied: python-dotenv in /home/adithya/miniconda3/envs/basic-rag/lib/python3.10/site-packages (1.0.1)\n"
          ]
        }
      ],
      "source": [
        "!pip install -U nest-asyncio\n",
        "!pip install -U llama-index\n",
        "!pip install -U llama-index-vector-stores-qdrant \n",
        "!pip install -U llama-index-readers-file \n",
        "!pip install -U llama-index-embeddings-fastembed \n",
        "!pip install -U llama-index-llms-openai\n",
        "!pip install -U llama-index-llms-groq\n",
        "!pip install -U qdrant_client fastembed\n",
        "!pip install -U python-dotenv"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 1,
      "id": "91b61e96-864c-4ed2-80d6-0ebfdbb57d5c",
      "metadata": {
        "id": "91b61e96-864c-4ed2-80d6-0ebfdbb57d5c"
      },
      "outputs": [],
      "source": [
        "import nest_asyncio\n",
        "\n",
        "nest_asyncio.apply()"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 2,
      "id": "2c7131e9",
      "metadata": {},
      "outputs": [],
      "source": [
        "# Standard library imports\n",
        "import logging\n",
        "import sys\n",
        "import os\n",
        "\n",
        "# Third-party imports\n",
        "from dotenv import load_dotenv\n",
        "from IPython.display import Markdown, display\n",
        "\n",
        "# Qdrant client import\n",
        "import qdrant_client\n",
        "\n",
        "# LlamaIndex core imports\n",
        "from llama_index.core import VectorStoreIndex, SimpleDirectoryReader\n",
        "from llama_index.core import Settings\n",
        "\n",
        "# LlamaIndex vector store import\n",
        "from llama_index.vector_stores.qdrant import QdrantVectorStore\n",
        "\n",
        "# Embedding model imports\n",
        "from llama_index.embeddings.fastembed import FastEmbedEmbedding\n",
        "from llama_index.embeddings.openai import OpenAIEmbedding\n",
        "\n",
        "# LLM import\n",
        "from llama_index.llms.openai import OpenAI\n",
        "from llama_index.llms.groq import Groq\n",
        "# Load environment variables\n",
        "load_dotenv()\n",
        "\n",
        "# Get OpenAI API key from environment variables\n",
        "OPENAI_API_KEY = os.getenv(\"OPENAI_API_KEY\")\n",
        "GROK_API_KEY = os.getenv(\"GROQ_API_KEY\")\n",
        "\n",
        "# Setting up Base LLM\n",
        "Settings.llm = OpenAI(\n",
        "    model=\"gpt-4o-mini\", temperature=0.1, max_tokens=1024, streaming=True\n",
        ")\n",
        "\n",
        "# Settings.llm = Groq(model=\"llama3-70b-8192\" , api_key=GROK_API_KEY)\n",
        "\n",
        "# Set the embedding model\n",
        "# Option 1: Use FastEmbed with BAAI/bge-base-en-v1.5 model (default)\n",
        "# Settings.embed_model = FastEmbedEmbedding(model_name=\"BAAI/bge-base-en-v1.5\")\n",
        "\n",
        "# Option 2: Use OpenAI's embedding model (commented out)\n",
        "# If you want to use OpenAI's embedding model, uncomment the following line:\n",
        "Settings.embed_model = OpenAIEmbedding(embed_batch_size=10, api_key=OPENAI_API_KEY)\n",
        "\n",
        "# Qdrant configuration (commented out)\n",
        "# If you're using Qdrant, uncomment and set these variables:\n",
        "# QDRANT_CLOUD_ENDPOINT = os.getenv(\"QDRANT_CLOUD_ENDPOINT\")\n",
        "# QDRANT_API_KEY = os.getenv(\"QDRANT_API_KEY\")\n",
        "\n",
        "# Note: Remember to add QDRANT_CLOUD_ENDPOINT and QDRANT_API_KEY to your .env file if using Qdrant Hosted version"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 4,
      "id": "88344ea2-540c-4b46-8a66-ed78870cb80a",
      "metadata": {
        "id": "88344ea2-540c-4b46-8a66-ed78870cb80a"
      },
      "outputs": [
        {
          "name": "stdout",
          "output_type": "stream",
          "text": [
            "🔃 Loading Data\n"
          ]
        },
        {
          "name": "stderr",
          "output_type": "stream",
          "text": [
            "Loading files: 100%|██████████| 13/13 [00:00<00:00, 41.67file/s]\n"
          ]
        }
      ],
      "source": [
        "# lets loading the documents using SimpleDirectoryReader\n",
        "\n",
        "print(\"🔃 Loading Data\")\n",
        "\n",
        "from llama_index.core import Document\n",
        "reader = SimpleDirectoryReader(\"../data/md/\" , recursive=True)\n",
        "documents = reader.load_data(show_progress=True)"
      ]
    },
    {
      "cell_type": "markdown",
      "id": "05b3aafa",
      "metadata": {},
      "source": [
        "## Setting up Vector Database\n",
        "\n",
        "We will be using qDrant as the Vector database\n",
        "There are 4 ways to initialize qdrant \n",
        "\n",
        "1. Inmemory\n",
        "```python\n",
        "client = qdrant_client.QdrantClient(location=\":memory:\")\n",
        "```\n",
        "2. Disk\n",
        "```python\n",
        "client = qdrant_client.QdrantClient(path=\"./data\")\n",
        "```\n",
        "3. Self hosted or Docker\n",
        "```python\n",
        "\n",
        "client = qdrant_client.QdrantClient(\n",
        "    # url=\"http://<host>:<port>\"\n",
        "    host=\"localhost\",port=6333\n",
        ")\n",
        "```\n",
        "\n",
        "4. Qdrant cloud\n",
        "```python\n",
        "client = qdrant_client.QdrantClient(\n",
        "    url=QDRANT_CLOUD_ENDPOINT,\n",
        "    api_key=QDRANT_API_KEY,\n",
        ")\n",
        "```\n",
        "\n",
        "for this notebook we will be using qdrant cloud"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 6,
      "id": "e0d60472",
      "metadata": {},
      "outputs": [],
      "source": [
        "# creating a qdrant client instance\n",
        "\n",
        "client = qdrant_client.QdrantClient(\n",
        "    # you can use :memory: mode for fast and light-weight experiments,\n",
        "    # it does not require to have Qdrant deployed anywhere\n",
        "    # but requires qdrant-client >= 1.1.1\n",
        "    # location=\":memory:\"\n",
        "    # otherwise set Qdrant instance address with:\n",
        "    # url=QDRANT_CLOUD_ENDPOINT,\n",
        "    # otherwise set Qdrant instance with host and port:\n",
        "    host=\"localhost\",\n",
        "    port=6333\n",
        "    # set API KEY for Qdrant Cloud\n",
        "    # api_key=QDRANT_API_KEY,\n",
        "    # path=\"./db/\"\n",
        ")\n",
        "\n",
        "vector_store = QdrantVectorStore(client=client, collection_name=\"02_ReRanker_RAG\")"
      ]
    },
    {
      "cell_type": "markdown",
      "id": "a4a677d6",
      "metadata": {},
      "source": [
        "### Ingest Data into vector DB"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "id": "82475b3c",
      "metadata": {},
      "outputs": [],
      "source": [
        "## ingesting data into vector database\n",
        "\n",
        "## lets set up an ingestion pipeline\n",
        "\n",
        "from llama_index.core.node_parser import TokenTextSplitter\n",
        "from llama_index.core.node_parser import SentenceSplitter\n",
        "from llama_index.core.node_parser import MarkdownNodeParser\n",
        "from llama_index.core.node_parser import SemanticSplitterNodeParser\n",
        "from llama_index.core.ingestion import IngestionPipeline\n",
        "\n",
        "pipeline = IngestionPipeline(\n",
        "    transformations=[\n",
        "        # MarkdownNodeParser(include_metadata=True),\n",
        "        # TokenTextSplitter(chunk_size=500, chunk_overlap=20),\n",
        "        SentenceSplitter(chunk_size=1024, chunk_overlap=20),\n",
        "        # SemanticSplitterNodeParser(buffer_size=1, breakpoint_percentile_threshold=95 , embed_model=Settings.embed_model),\n",
        "        Settings.embed_model,\n",
        "    ],\n",
        "    vector_store=vector_store,\n",
        ")\n",
        "\n",
        "# Ingest directly into a vector db\n",
        "nodes = pipeline.run(documents=documents , show_progress=True)\n",
        "print(\"Number of chunks added to vector DB :\",len(nodes))"
      ]
    },
    {
      "cell_type": "markdown",
      "id": "d0a3c64f",
      "metadata": {},
      "source": [
        "## Setting Up Index"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 7,
      "id": "da6fc12a",
      "metadata": {},
      "outputs": [],
      "source": [
        "index = VectorStoreIndex.from_vector_store(vector_store=vector_store)"
      ]
    },
    {
      "cell_type": "markdown",
      "id": "7e3d5f23-dfcd-458d-a9d3-dd66de0ab054",
      "metadata": {
        "id": "7e3d5f23-dfcd-458d-a9d3-dd66de0ab054"
      },
      "source": [
        "## Retrieval Comparisons"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 8,
      "id": "47480c6d-8914-4562-a789-fd53a99a7afb",
      "metadata": {
        "id": "47480c6d-8914-4562-a789-fd53a99a7afb",
        "outputId": "04fa0ca7-1c01-4536-e5a3-86249ad0e283"
      },
      "outputs": [],
      "source": [
        "from llama_index.core.retrievers import VectorIndexRetriever\n",
        "from llama_index.core import QueryBundle\n",
        "import pandas as pd\n",
        "from IPython.display import display, HTML\n",
        "from copy import deepcopy\n",
        "from llama_index.core.postprocessor import LLMRerank\n",
        "\n",
        "\n",
        "def get_retrieved_nodes(\n",
        "    query_str, vector_top_k=10, reranker_top_n=3, with_reranker=False\n",
        "):\n",
        "    query_bundle = QueryBundle(query_str)\n",
        "    # configure retriever\n",
        "    retriever = VectorIndexRetriever(\n",
        "        index=index,\n",
        "        similarity_top_k=vector_top_k,\n",
        "    )\n",
        "    retrieved_nodes = retriever.retrieve(query_bundle)\n",
        "\n",
        "    if with_reranker:\n",
        "        # configure reranker\n",
        "        reranker = LLMRerank(\n",
        "            choice_batch_size=5,\n",
        "            top_n=reranker_top_n,\n",
        "        )\n",
        "        retrieved_nodes = reranker.postprocess_nodes(\n",
        "            retrieved_nodes, query_bundle\n",
        "        )\n",
        "\n",
        "    return retrieved_nodes\n",
        "\n",
        "\n",
        "def pretty_print(df):\n",
        "    return display(HTML(df.to_html().replace(\"\\\\n\", \"<br>\")))\n",
        "\n",
        "\n",
        "def visualize_retrieved_nodes(nodes) -> None:\n",
        "    result_dicts = []\n",
        "    for node in nodes:\n",
        "        # node = deepcopy(node)\n",
        "        # node.node.metadata = None\n",
        "        node_text = node.node.get_text()\n",
        "        node_text = node_text.replace(\"\\n\", \" \")\n",
        "\n",
        "        result_dict = {\"Score\": node.score, \"Text\": node_text}\n",
        "        result_dicts.append(result_dict)\n",
        "\n",
        "    pretty_print(pd.DataFrame(result_dicts))"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 9,
      "id": "b8bedc4f-444b-4233-9b72-728e3cfbe056",
      "metadata": {
        "id": "b8bedc4f-444b-4233-9b72-728e3cfbe056",
        "outputId": "c760c3b4-d9df-4122-c6a3-c0f2b83dbfa8"
      },
      "outputs": [],
      "source": [
        "new_nodes = get_retrieved_nodes(\n",
        "    \"What is Attention\", vector_top_k=5, with_reranker=False\n",
        ")"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 10,
      "id": "e85e656b-9377-4640-a10d-a6655afd82bd",
      "metadata": {
        "id": "e85e656b-9377-4640-a10d-a6655afd82bd",
        "outputId": "86c28dde-995f-4a9d-e99d-0c224741cdc2"
      },
      "outputs": [
        {
          "data": {
            "text/html": [
              "<table border=\"1\" class=\"dataframe\">\n",
              "  <thead>\n",
              "    <tr style=\"text-align: right;\">\n",
              "      <th></th>\n",
              "      <th>Score</th>\n",
              "      <th>Text</th>\n",
              "    </tr>\n",
              "  </thead>\n",
              "  <tbody>\n",
              "    <tr>\n",
              "      <th>0</th>\n",
              "      <td>0.828242</td>\n",
              "      <td>3.2 Attention  An attention function can be described as mapping a query and a set of key-value pairs to an output, where the query, keys, values, and output are all vectors. The output is computed as a weighted sum. ---</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>1</th>\n",
              "      <td>0.828206</td>\n",
              "      <td>3.2 Attention  An attention function can be described as mapping a query and a set of key-value pairs to an output, where the query, keys, values, and output are all vectors. The output is computed as a weighted sum. ---</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>2</th>\n",
              "      <td>0.825941</td>\n",
              "      <td>Attention Visualizations  It is this spirit that a majority of American governments have passed new laws since 2009.  Figure 3: An example of the attention mechanism following long-distance dependencies in the encoder self-attention in layer 5 of 6. Many of the attention heads attend to a distant dependency of the verb ‘making’, completing the phrase ‘making...more difficult’. Attentions here shown only for the word ‘making’. Different colors represent different heads. Best viewed in color.  Voting process more difficult. ---</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>3</th>\n",
              "      <td>0.816966</td>\n",
              "      <td>Attention Visualizations  It is this spirit that a majority of American governments have passed new laws since 2009.  Figure 3: An example of the attention mechanism following long-distance dependencies in the encoder self-attention in layer 5 of 6.  Attentions here shown only for the word ‘making’. Different colors represent different heads. Best viewed in color. ---</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>4</th>\n",
              "      <td>0.808573</td>\n",
              "      <td>Figure 4  Two attention heads, also in layer 5 of 6, apparently involved in anaphora resolution. Top: Full attentions for head 5. Bottom: Isolated attentions from just the word ‘its’ for attention heads 5 and 6. Note that the attentions are very sharp for this word.  14 ---</td>\n",
              "    </tr>\n",
              "  </tbody>\n",
              "</table>"
            ],
            "text/plain": [
              "<IPython.core.display.HTML object>"
            ]
          },
          "metadata": {},
          "output_type": "display_data"
        }
      ],
      "source": [
        "visualize_retrieved_nodes(new_nodes)"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 11,
      "id": "8ba150e2-c4e7-4404-b8e1-1603c2b346d3",
      "metadata": {
        "id": "8ba150e2-c4e7-4404-b8e1-1603c2b346d3",
        "outputId": "35655788-a1b1-4452-f0ff-4b983aafadfa"
      },
      "outputs": [],
      "source": [
        "new_nodes = get_retrieved_nodes(\n",
        "    \"What is Attention\",\n",
        "    vector_top_k=20,\n",
        "    reranker_top_n=5,\n",
        "    with_reranker=True,\n",
        ")"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 12,
      "id": "7541606f-6424-470b-987c-a986ac0a7cf8",
      "metadata": {
        "id": "7541606f-6424-470b-987c-a986ac0a7cf8",
        "outputId": "9c514a6f-b6bd-4480-be17-702f5fe551c6"
      },
      "outputs": [
        {
          "data": {
            "text/html": [
              "<table border=\"1\" class=\"dataframe\">\n",
              "  <thead>\n",
              "    <tr style=\"text-align: right;\">\n",
              "      <th></th>\n",
              "      <th>Score</th>\n",
              "      <th>Text</th>\n",
              "    </tr>\n",
              "  </thead>\n",
              "  <tbody>\n",
              "    <tr>\n",
              "      <th>0</th>\n",
              "      <td>9.0</td>\n",
              "      <td>3.2 Attention  An attention function can be described as mapping a query and a set of key-value pairs to an output, where the query, keys, values, and output are all vectors. The output is computed as a weighted sum. ---</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>1</th>\n",
              "      <td>9.0</td>\n",
              "      <td>3.2 Attention  An attention function can be described as mapping a query and a set of key-value pairs to an output, where the query, keys, values, and output are all vectors. The output is computed as a weighted sum. ---</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>2</th>\n",
              "      <td>9.0</td>\n",
              "      <td>2 Background  The goal of reducing sequential computation also forms the foundation of the Extended Neural GPU [16], ByteNet [18] and ConvS2S [9], all of which use convolutional neural networks as basic building block, computing hidden representations in parallel for all input and output positions. In these models, the number of operations required to relate signals from two arbitrary input or output positions grows in the distance between positions, linearly for ConvS2S and logarithmically for ByteNet. This makes it more difficult to learn dependencies between distant positions [12]. In the Transformer this is reduced to a constant number of operations, albeit at the cost of reduced effective resolution due to averaging attention-weighted positions, an effect we counteract with Multi-Head Attention as described in section 3.2.  Self-attention, sometimes called intra-attention is an attention mechanism relating different positions of a single sequence in order to compute a representation of the sequence. Self-attention has been used successfully in a variety of tasks including reading comprehension, abstractive summarization, textual entailment and learning task-independent sentence representations [4, 27, 28, 22].  End-to-end memory networks are based on a recurrent attention mechanism instead of sequence-aligned recurrence and have been shown to perform well on simple-language question answering and language modeling tasks [34].  To the best of our knowledge, however, the Transformer is the first transduction model relying entirely on self-attention to compute representations of its input and output without using sequence-aligned RNNs or convolution. In the following sections, we will describe the Transformer, motivate self-attention and discuss its advantages over models such as [17, 18] and [9].</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>3</th>\n",
              "      <td>9.0</td>\n",
              "      <td>3.2.1 Scaled Dot-Product Attention  We call our particular attention \"Scaled Dot-Product Attention\" (Figure 2). The input consists of queries and keys of dimension dk, and values of dimension dv. We compute the dot products of the query with all keys, divide each by √dk, and apply a softmax function to obtain the weights on the values.  In practice, we compute the attention function on a set of queries simultaneously, packed together into a matrix Q. The keys and values are also packed together into matrices K and V. We compute the matrix of outputs as:  Attention(Q, K, V) = softmax( √dk Q KT ) V (1)  The two most commonly used attention functions are additive attention [2], and dot-product (multiplicative) attention. Dot-product attention is identical to our algorithm, except for the scaling factor √1/dk. Additive attention computes the compatibility function using a feed-forward network with a single hidden layer. While the two are similar in theoretical complexity, dot-product attention is much faster and more space-efficient in practice, since it can be implemented using highly optimized matrix multiplication code.  While for small values of dk the two mechanisms perform similarly, additive attention outperforms dot product attention without scaling for larger values of dk [3]. We suspect that for large values of dk, the dot products grow large in magnitude, pushing the softmax function into regions where it has extremely small gradients4. To counteract this effect, we scale the dot products by √1/dk.</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>4</th>\n",
              "      <td>9.0</td>\n",
              "      <td>1 Introduction  Recurrent neural networks, long short-term memory [13] and gated recurrent [7] neural networks in particular, have been firmly established as state of the art approaches in sequence modeling and transduction problems such as language modeling and machine translation [35, 2, 5]. Numerous efforts have since continued to push the boundaries of recurrent language models and encoder-decoder architectures [38, 24, 15].  Recurrent models typically factor computation along the symbol positions of the input and output sequences. Aligning the positions to steps in computation time, they generate a sequence of hidden states ht, as a function of the previous hidden state ht−1 and the input for position t. This inherently sequential nature precludes parallelization within training examples, which becomes critical at longer sequence lengths, as memory constraints limit batching across examples. Recent work has achieved significant improvements in computational efficiency through factorization tricks [21] and conditional computation [32], while also improving model performance in case of the latter. The fundamental constraint of sequential computation, however, remains.  Attention mechanisms have become an integral part of compelling sequence modeling and transduction models in various tasks, allowing modeling of dependencies without regard to their distance in the input or output sequences [2, 19]. In all but a few cases [27], however, such attention mechanisms are used in conjunction with a recurrent network.  In this work we propose the Transformer, a model architecture eschewing recurrence and instead relying entirely on an attention mechanism to draw global dependencies between input and output. The Transformer allows for significantly more parallelization and can reach a new state of the art in translation quality after being trained for as little as twelve hours on eight P100 GPUs.</td>\n",
              "    </tr>\n",
              "  </tbody>\n",
              "</table>"
            ],
            "text/plain": [
              "<IPython.core.display.HTML object>"
            ]
          },
          "metadata": {},
          "output_type": "display_data"
        }
      ],
      "source": [
        "visualize_retrieved_nodes(new_nodes)"
      ]
    },
    {
      "cell_type": "markdown",
      "id": "35d84ea0",
      "metadata": {},
      "source": [
        "### LLM ReRanker"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 13,
      "id": "afced092",
      "metadata": {},
      "outputs": [],
      "source": [
        "query_engine = index.as_query_engine(\n",
        "    similarity_top_k=10,\n",
        "    node_postprocessors=[\n",
        "        LLMRerank(\n",
        "            choice_batch_size=5,\n",
        "            top_n=2,\n",
        "        )\n",
        "    ],\n",
        "    response_mode=\"tree_summarize\",\n",
        ")"
      ]
    },
    {
      "cell_type": "markdown",
      "id": "e183ed78",
      "metadata": {},
      "source": [
        "### Cohere ReRanker"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "id": "d67ae8ac",
      "metadata": {},
      "outputs": [],
      "source": [
        "# !pip install llama-index-postprocessor-cohere-rerank"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "id": "b20c0c27",
      "metadata": {},
      "outputs": [],
      "source": [
        "# from llama_index.postprocessor.cohere_rerank import CohereRerank\n",
        "\n",
        "# cohere_api_key = os.environ[\"COHERE_API_KEY\"]\n",
        "# cohere_rerank = CohereRerank(api_key=cohere_api_key, top_n=2)\n",
        "\n",
        "# query_engine = index.as_query_engine(\n",
        "#     similarity_top_k=10,\n",
        "#     node_postprocessors=[cohere_rerank],\n",
        "# )"
      ]
    },
    {
      "cell_type": "markdown",
      "id": "8ef66d1c",
      "metadata": {},
      "source": [
        "### Colber ReRanker"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "id": "b1100a57",
      "metadata": {},
      "outputs": [],
      "source": [
        "# !pip install -U llama-index-postprocessor-colbert-rerank"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "id": "881f71e5",
      "metadata": {},
      "outputs": [],
      "source": [
        "# from llama_index.postprocessor.colbert_rerank import ColbertRerank\n",
        "\n",
        "# colbert_reranker = ColbertRerank(\n",
        "#     top_n=5,\n",
        "#     model=\"colbert-ir/colbertv2.0\",\n",
        "#     tokenizer=\"colbert-ir/colbertv2.0\",\n",
        "#     keep_retrieval_score=True,\n",
        "# )\n",
        "\n",
        "# query_engine = index.as_query_engine(\n",
        "#     similarity_top_k=10,\n",
        "#     node_postprocessors=[colbert_reranker],\n",
        "# )"
      ]
    },
    {
      "cell_type": "markdown",
      "id": "ec2512b0",
      "metadata": {},
      "source": [
        "### Flag Embedding ReRanker"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "id": "5cd4e239",
      "metadata": {},
      "outputs": [],
      "source": [
        "# !pip install llama-index-postprocessor-flag-embedding-reranker\n",
        "# !pip install git+https://github.com/FlagOpen/FlagEmbedding.git"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 5,
      "id": "e1990e34",
      "metadata": {},
      "outputs": [],
      "source": [
        "# from llama_index.postprocessor.flag_embedding_reranker import (\n",
        "#     FlagEmbeddingReranker,\n",
        "# )\n",
        "\n",
        "# rerank = FlagEmbeddingReranker(model=\"BAAI/bge-reranker-large\", top_n=5)\n",
        "\n",
        "# query_engine = index.as_query_engine(\n",
        "#     similarity_top_k=10, node_postprocessors=[rerank]\n",
        "# )"
      ]
    },
    {
      "cell_type": "markdown",
      "id": "f9fa5bca",
      "metadata": {},
      "source": [
        "### Sentence Transformer ReRanker"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "id": "2b352ec4",
      "metadata": {},
      "outputs": [],
      "source": [
        "# !pip install llama-index-embeddings-huggingface"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "id": "66e9afc4",
      "metadata": {},
      "outputs": [],
      "source": [
        "# from llama_index.core.postprocessor import SentenceTransformerRerank\n",
        "\n",
        "# rerank = SentenceTransformerRerank(\n",
        "#     model=\"cross-encoder/ms-marco-MiniLM-L-2-v2\", top_n=3\n",
        "# )\n",
        "\n",
        "# query_engine = index.as_query_engine(\n",
        "#     similarity_top_k=10, node_postprocessors=[rerank]\n",
        "# )\n"
      ]
    },
    {
      "cell_type": "markdown",
      "id": "ff5bbf1b",
      "metadata": {},
      "source": [
        "### Set Up Query Engine"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 14,
      "id": "b358c704",
      "metadata": {},
      "outputs": [
        {
          "data": {
            "text/markdown": [
              "Attention is a function that maps a query and a set of key-value pairs to an output. In this process, the query, keys, values, and output are all represented as vectors. The resulting output is calculated as a weighted sum of these vectors."
            ],
            "text/plain": [
              "<IPython.core.display.Markdown object>"
            ]
          },
          "metadata": {},
          "output_type": "display_data"
        }
      ],
      "source": [
        "response = query_engine.query(\n",
        "    \"What is Attention\"\n",
        ")\n",
        "\n",
        "display(Markdown(str(response)))"
      ]
    }
  ],
  "metadata": {
    "colab": {
      "provenance": []
    },
    "kernelspec": {
      "display_name": "basic-rag",
      "language": "python",
      "name": "python3"
    },
    "language_info": {
      "codemirror_mode": {
        "name": "ipython",
        "version": 3
      },
      "file_extension": ".py",
      "mimetype": "text/x-python",
      "name": "python",
      "nbconvert_exporter": "python",
      "pygments_lexer": "ipython3",
      "version": "3.10.14"
    }
  },
  "nbformat": 4,
  "nbformat_minor": 5
}
